Close remote app on error or disconnect

This commit is contained in:
Rafostar
2020-12-15 19:03:58 +01:00
parent dde35270ff
commit a1e95dc012
2 changed files with 16 additions and 1 deletions

View File

@@ -57,7 +57,7 @@ class ClapperWebClient extends Soup.Session
}
if(!connection)
return;
return this.passMsgData('close');
connection.connect('message', this._onWsMessage.bind(this));
connection.connect('closed', this._onWsClosed.bind(this));
@@ -78,5 +78,7 @@ class ClapperWebClient extends Soup.Session
_onWsClosed(connection)
{
debug('closed WebSocket connection');
this.passMsgData('close');
}
});

View File

@@ -9,5 +9,18 @@ class ClapperWidgetRemote extends Gtk.Grid
super._init();
this.player = new PlayerRemote();
this.player.webclient.passMsgData = this.receiveWs.bind(this);
}
receiveWs(action, value)
{
switch(action) {
case 'close':
let root = this.get_root();
root.run_dispose();
break;
default:
break;
}
}
});