mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 16:02:00 +02:00
Close remote app on error or disconnect
This commit is contained in:
@@ -57,7 +57,7 @@ class ClapperWebClient extends Soup.Session
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!connection)
|
if(!connection)
|
||||||
return;
|
return this.passMsgData('close');
|
||||||
|
|
||||||
connection.connect('message', this._onWsMessage.bind(this));
|
connection.connect('message', this._onWsMessage.bind(this));
|
||||||
connection.connect('closed', this._onWsClosed.bind(this));
|
connection.connect('closed', this._onWsClosed.bind(this));
|
||||||
@@ -78,5 +78,7 @@ class ClapperWebClient extends Soup.Session
|
|||||||
_onWsClosed(connection)
|
_onWsClosed(connection)
|
||||||
{
|
{
|
||||||
debug('closed WebSocket connection');
|
debug('closed WebSocket connection');
|
||||||
|
|
||||||
|
this.passMsgData('close');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -9,5 +9,18 @@ class ClapperWidgetRemote extends Gtk.Grid
|
|||||||
super._init();
|
super._init();
|
||||||
|
|
||||||
this.player = new PlayerRemote();
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user