loleaflet/src/core/Socket.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
New commits: commit 29aef0af4b5c2a883131f60c7cea5f13eddf48f6 Author: Pranav Kant <pran...@collabora.co.uk> Date: Fri Aug 25 17:38:26 2017 +0530 loleaflet: Mention the reason of closing websocket to WOPI hosts Reason is part of the JSON of post message with ID, 'Session_Close'. Change-Id: I51a465f63fbd80843292a3f19c5b89f920301194 diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js index 68f3ea4f..e0a0cc8a 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -241,21 +241,25 @@ L.Socket = L.Class.extend({ else if (textMsg.startsWith('close: ')) { textMsg = textMsg.substring('close: '.length); msg = ''; - + var postMsgData = {}; // This is due to document owner terminating the session if (textMsg === 'ownertermination') { msg = _('Session terminated by document owner'); + postMsgData['Reason'] = 'OwnerTermination'; } else if (textMsg === 'idle' || textMsg === 'oom') { msg = _('Session was terminated due to idleness - please click to reload'); this._map._documentIdle = true; + postMsgData['Reason'] = 'DocumentIdle'; + if (textMsg === 'oom') + postMsgData['Reason'] = 'OOM'; } else if (textMsg === 'shuttingdown') { msg = _('Server is shutting down for maintenance (auto-saving)'); + postMsgData['Reason'] = 'ShuttingDown'; } else if (textMsg === 'recycling') { msg = _('Server is recycling and will be available shortly'); - this._map._active = false; this._map._serverRecycling = true; @@ -349,9 +353,9 @@ L.Socket = L.Class.extend({ $(options.appendLocation).append(options.$vex); vex.setupBodyClassName(options.$vex); - if (textMsg !== 'shuttingdown') { + if (postMsgData['Reason']) { // Tell WOPI host about it which should handle this situation - this._map.fire('postMessage', {msgId: 'Session_Closed'}); + this._map.fire('postMessage', {msgId: 'Session_Closed', args: postMsgData}); } if (textMsg === 'ownertermination') { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits