Bug 103640 - PostMessage API: closeSession
Summary: PostMessage API: closeSession
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice Online
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.3.0
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-02 08:48 UTC by Aleksander Machniak
Modified: 2016-11-11 08:51 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aleksander Machniak 2016-11-02 08:48:56 UTC
As described in #103450:
- users can create document editing sessions (DES)
- when DES is created its creator becomes a "DES owner"
- DES owner can invite other users to the session,
- uninvited users can't join the session without invitation,
- any user can create a separate session on a document, even if it's already edited by someone else (other DESs exist).
- only DES owner can terminate/destroy/close the DES.

Having above in mind I need a postMessage API messages that will:
1. "Close_Session" message (host -> editor), to allow the DES owner to terminate the session.
   When such a message is received, Office Online should inform all session members (views) that the session has been closed. In such a case host page would inform the user with a message and close the editor window. This can be done with
2. "Session_Closed" message (editor -> host).
Comment 1 Commit Notification 2016-11-10 09:36:01 UTC
Pranav Kant committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/online/commit/?id=b0933b063e8b0e8e0de7eeeb9706fb291af72b5c

tdf#103640: Implement OwnerTermination; send application-level close frame
Comment 2 Pranav Kant 2016-11-10 17:25:32 UTC
To enable this kind of owner termination you need to specify 'EnableOwnerTermination' as 'true' in CheckFileInfo response. The owner of the document (based on 'OwnerId' field in CheckFileInfo response) will then be able to terminate all sessions when WOPI host sends 'Close_Session' via post message API. No other session will be able to terminate other sessions if its UserId does not match the OwnerId in CheckFileInfo response - LOOL will quietly ignore you if you send 'Close_Session' from such sessions.

Note that EnableOwnerTermination needs to be string 'true'. I will address this with Bug 103671
Comment 3 Pranav Kant 2016-11-11 08:51:47 UTC
Dumping some more notes:

I have noticed that in chrome the WebSocket's onclose is triggered not when server sends the CLOSE frame, but when the TCP connection is closed. This leads to chrome triggering onclose event with statusCode = 1006 and reason = '' which signifies a browser side websocket close. This is not the case in Firefox.