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.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
This commit is contained in:
parent
8f6df70333
commit
088658807a
1 changed files with 3 additions and 0 deletions
|
@ -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});
|
||||
|
|
Loading…
Reference in a new issue