Add connection termination message for unexpected terminations

This commit is contained in:
Cameron Gutman
2019-02-27 00:55:27 -08:00
parent b48cb3d069
commit 87f6f14af6
2 changed files with 12 additions and 4 deletions

View File

@@ -36,10 +36,16 @@ function handleMessage(msg) {
delete callbacks[msg.data.callbackId]
} else { // else, it's just info, or an event
console.log('%c[messages.js, handleMessage]', 'color:gray;', 'Message data: ', msg.data)
if (msg.data === 'streamTerminated') { // if it's a recognized event, notify the appropriate function
if (msg.data.indexOf('streamTerminated: ') === 0) { // if it's a recognized event, notify the appropriate function
// Release our keep awake request
chrome.power.releaseKeepAwake();
// Show a termination snackbar message if the termination was unexpected
var errorCode = parseInt(msg.data.replace('streamTerminated: ', ''));
if (errorCode !== 0) {
snackbarLogLong("Connection terminated");
}
api.refreshServerInfo().then(function(ret) {
// Return to app list with new currentgame
showApps(api);