loleaflet/src/core/Socket.js | 3 +++ 1 file changed, 3 insertions(+) New commits: commit 088658807ac2340344ffdabaec42885b15b8f62b Author: Pranav Kant <pran...@collabora.co.uk> Date: Wed May 2 23:19:48 2018 +0530
loleaflet: close previous socket before connecting new one It's possible otherwise in some scenarios that multiple sockets are created in one browser tab while there should only be one for one browser tab. Change-Id: I242ba62effee24c4ab04367001459448b4ff5817 Reviewed-on: https://gerrit.libreoffice.org/53749 Reviewed-by: Michael Meeks <michael.me...@collabora.com> Tested-by: Michael Meeks <michael.me...@collabora.com> diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js index 4275a3d7c..edb1c2435 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -34,6 +34,9 @@ L.Socket = L.Class.extend({ var websocketURI = map.options.server + '/lool/' + encodeURIComponent(map.options.doc + '?' + $.param(map.options.docParams)) + '/ws' + wopiSrc; try { + if (this.socket) { + this.close(); + } this.socket = new WebSocket(websocketURI); } catch (e) { this._map.fire('error', {msg: _('Oops, there is a problem connecting to LibreOffice Online : ').replace('LibreOffice Online', (typeof brandProductName !== 'undefined' ? brandProductName : 'LibreOffice Online')) + _('Cannot create websocket, please restart your browser.'), cmd: 'socket', kind: 'failed', id: 3}); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits