loleaflet: Socket.connected() to report socket connection state

Change-Id: Ib777f1af52dac518ceae7234334af4108943fc07
Reviewed-on: https://gerrit.libreoffice.org/24350
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Ashod Nakashian 2016-04-24 16:48:32 -04:00 committed by Ashod Nakashian
parent 2fc74ee650
commit 381badc3cb

View file

@ -30,6 +30,10 @@ L.Socket = L.Class.extend({
this.socket.close();
},
connected: function() {
return this.socket && this.socket.readyState === 1;
},
sendMessage: function (msg, coords) {
if (!msg.startsWith('useractive') && !msg.startsWith('userinactive') && !this._active) {
// Avoid communicating when we're inactive.