2015-03-19 06:55:06 -05:00
|
|
|
All communication consists of messages that are one line of
|
|
|
|
human-readable UTF-8 text optionally followed by a single newline and
|
|
|
|
binary data.
|
2015-03-05 07:57:03 -06:00
|
|
|
|
2015-03-24 12:04:16 -05:00
|
|
|
The protocol is not a request-response one. Messages may be sent in
|
|
|
|
either direction at any time, either in response to some message, or
|
|
|
|
spontaneously. For 'tile' messages, the client may send a bunch of
|
|
|
|
tile requests without waiting for return messages. The server may send
|
|
|
|
tiles proactively (guessing what the client might need). Etc.
|
|
|
|
|
2015-03-04 17:14:04 -06:00
|
|
|
client -> server
|
|
|
|
================
|
|
|
|
|
2015-06-05 08:12:06 -05:00
|
|
|
canceltiles
|
|
|
|
|
|
|
|
All outstanding tile messages from the client to the server are
|
2015-06-09 08:09:23 -05:00
|
|
|
dropped and will not be handled. There is no guarantee of exactly
|
2015-06-05 08:12:06 -05:00
|
|
|
which tile: messages might still be sent back to the client.
|
|
|
|
|
2016-02-18 07:42:31 -06:00
|
|
|
downloadas name=<fileName> id=<id> format=<document format> options=<SkipImages, etc>
|
2015-10-09 07:55:49 -05:00
|
|
|
|
|
|
|
Exports the current document to the desired format and returns a download URL
|
2015-10-13 12:56:42 -05:00
|
|
|
The id identifies the request on the client.
|
2015-10-09 07:55:49 -05:00
|
|
|
|
2015-10-22 10:32:19 -05:00
|
|
|
getchildid
|
|
|
|
|
|
|
|
Requests the child id so that it knows where the files needs to be sent when it is
|
|
|
|
inserted in the document
|
|
|
|
|
2015-06-24 10:08:15 -05:00
|
|
|
gettextselection mimetype=<mimeType>
|
|
|
|
|
|
|
|
Request selection's content
|
|
|
|
|
2016-01-15 07:42:02 -06:00
|
|
|
paste mimetype=<mimeType>
|
|
|
|
<binaryPasteData>
|
2015-10-27 04:40:40 -05:00
|
|
|
|
|
|
|
Paste content at the current cursor position.
|
|
|
|
|
2015-10-22 10:32:19 -05:00
|
|
|
insertfile name=<name> type=<type>
|
|
|
|
|
|
|
|
Inserts the file with the name <name> into the document, we currently support type = 'graphic'
|
|
|
|
|
2015-05-28 09:57:29 -05:00
|
|
|
invalidatetiles part=<partNumber> tileposx=<xpos> tileposy=<ypos> tilewidth=<tileWidth> tileheight=<tileHeight>
|
|
|
|
|
|
|
|
All parameters are numbers. Makes the server remove any cached
|
|
|
|
tiles intersecting with the given area (in twips).
|
|
|
|
|
2015-05-28 09:55:49 -05:00
|
|
|
key type=<type> char=<charcode> key=<keycode>
|
|
|
|
|
|
|
|
<type> is 'input' or 'up', <charcode> and <keycode> are numbers.
|
|
|
|
|
2015-03-19 07:38:04 -05:00
|
|
|
load <pathname>
|
|
|
|
|
|
|
|
Deprecated.
|
|
|
|
|
2015-11-18 11:09:13 -06:00
|
|
|
load [part=<partNumber>] url=<url> [timestamp=<time>] [options=<options>]
|
2015-11-18 10:53:03 -06:00
|
|
|
|
|
|
|
part is an optional parameter. <partNumber> is a number.
|
2015-08-04 13:42:27 -05:00
|
|
|
|
|
|
|
timestamp is an optional parameter. <time> is provided in microseconds
|
|
|
|
since the Unix epoch - midnight, January 1, 1970.
|
2015-03-04 17:14:04 -06:00
|
|
|
|
2015-11-18 11:09:13 -06:00
|
|
|
options are the whole rest of the line, not URL-encoded
|
|
|
|
|
2016-01-21 09:11:39 -06:00
|
|
|
loolclient <major.minor[-patch]>
|
|
|
|
|
|
|
|
Upon connection, a client must announce the version number it supports.
|
|
|
|
Major: an integer that must always match between client and server,
|
|
|
|
otherwise there are no guarantees of any sensible
|
|
|
|
compatibility. This is bumped when API changes.
|
|
|
|
Minor: an integer is more flexible and is at the discretion of either party.
|
|
|
|
Security fixes that do not alter the API would bump the minor version number.
|
|
|
|
Patch: an optional string that is informational.
|
|
|
|
|
2015-03-19 07:38:04 -05:00
|
|
|
mouse type=<type> x=<x> y=<y> count=<count>
|
|
|
|
|
|
|
|
<type> is 'buttondown', 'buttonup' or 'move', others are numbers.
|
|
|
|
|
2015-11-27 08:13:25 -06:00
|
|
|
renderfont font=<font>
|
|
|
|
|
|
|
|
requests the rendering of the given font.
|
|
|
|
The font parameter is URL encoded
|
|
|
|
|
2015-08-06 10:54:45 -05:00
|
|
|
requestloksession
|
|
|
|
|
|
|
|
requests the initialization of a LOK process in an attempt to predict the user's
|
|
|
|
interaction with the document
|
|
|
|
|
2015-05-28 09:55:49 -05:00
|
|
|
resetselection
|
2015-03-19 07:38:04 -05:00
|
|
|
|
2015-05-28 09:55:49 -05:00
|
|
|
saveas url=<url> format=<format> options=<options>
|
|
|
|
|
2015-07-16 04:00:27 -05:00
|
|
|
<url> is a URL, encoded. <format> is also URL-encoded, i.e. spaces as %20 and it can be empty
|
2015-05-28 09:55:49 -05:00
|
|
|
options are the whole rest of the line, not URL-encoded, and can be empty
|
2015-03-19 07:38:04 -05:00
|
|
|
|
|
|
|
selecttext type=<type> x=<x> y=<y>
|
|
|
|
|
|
|
|
<type> is 'start', 'end' or 'reset', <x> and <y> are numbers.
|
|
|
|
|
|
|
|
selectgraphic type=<type> x=<x> y=<y>
|
|
|
|
|
|
|
|
<type> is 'start' or 'end' <x> and <y> are numbers.
|
|
|
|
|
2015-05-28 09:55:49 -05:00
|
|
|
status
|
2015-03-19 07:38:04 -05:00
|
|
|
|
2015-08-18 13:01:05 -05:00
|
|
|
styles
|
|
|
|
|
2015-05-28 09:55:49 -05:00
|
|
|
tile part=<partNumber> width=<width> height=<height> tileposx=<xpos> tileposy=<ypos> tilewidth=<tileWidth> tileheight=<tileHeight>
|
|
|
|
|
|
|
|
All parameters are numbers.
|
|
|
|
|
2016-02-18 12:25:30 -06:00
|
|
|
tilecombine <parameters>
|
|
|
|
|
|
|
|
Accept same parameters as 'tile' message except parameters 'tileposx' and 'tileposy'
|
|
|
|
can be a comma separated list, and number of elements in both must be same.
|
|
|
|
|
2016-01-21 09:11:39 -06:00
|
|
|
unload [save|force]
|
|
|
|
|
|
|
|
unloads the document.
|
|
|
|
|
|
|
|
if 'save' is specified, the document is saved before unloading,
|
|
|
|
otherwise, changes are discarded.
|
|
|
|
if other users have the document open, and save not specified,
|
|
|
|
'force' is necessary to discard changes.
|
|
|
|
|
2015-05-28 09:55:49 -05:00
|
|
|
uno <command>
|
|
|
|
|
|
|
|
<command> is a line of text.
|
2015-03-23 15:13:57 -05:00
|
|
|
|
2015-09-29 05:55:21 -05:00
|
|
|
partpagerectangles
|
|
|
|
|
|
|
|
Invokes lok::Document::getPartPageRectangles().
|
2015-03-23 15:13:57 -05:00
|
|
|
|
2016-02-02 04:48:41 -06:00
|
|
|
clientvisiblearea x=<x> y=<y> width=<width> height=<height>
|
|
|
|
|
|
|
|
Invokes lok::Document::setClientVisibleArea().
|
|
|
|
|
2015-03-04 17:14:04 -06:00
|
|
|
server -> client
|
|
|
|
================
|
|
|
|
|
2016-01-06 11:00:44 -06:00
|
|
|
loolserver <major.minor[-patch]>
|
|
|
|
|
|
|
|
Upon connection, the server must announce the version number it supports.
|
|
|
|
Major: an integer that must always match between client and server,
|
|
|
|
otherwise there are no guarantees of any sensible
|
|
|
|
compatibility. This is bumped when API changes.
|
|
|
|
Minor: an integer is more flexible and is at the discretion of either party.
|
|
|
|
Security fixes that do not alter the API would bump the minor version number.
|
|
|
|
Patch: an optional string that is informational.
|
|
|
|
|
2016-04-08 12:13:19 -05:00
|
|
|
contextmenu: <json description of the context menu>
|
|
|
|
|
|
|
|
When the user right-clicks in the document, the content of the context
|
|
|
|
menu is sent back via this callback.
|
|
|
|
|
|
|
|
The structure of the context menu is a JSON, and looks like:
|
|
|
|
|
|
|
|
{
|
|
|
|
"menu": [
|
|
|
|
{ "text": "label text1", "type": "command", "command": ".uno:Something1", "enabled": "true" },
|
|
|
|
{ "text": "label text2", "type": "command", "command": ".uno:Something2", "enabled": "false" },
|
|
|
|
{ "type": "separator" },
|
|
|
|
{ "text": "label text2", "type": "menu", "menu": [ { ... }, { ... }, ... ] },
|
|
|
|
...
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2015-10-09 07:55:49 -05:00
|
|
|
downloadas: jail=<jail directory> dir=<a tmp dir> name=<name> port=<port>
|
|
|
|
|
|
|
|
The client should then request http://server:port/jail/dir/name in order to download
|
|
|
|
the document
|
|
|
|
|
2016-04-08 15:22:17 -05:00
|
|
|
editlock: <1 or 0>
|
|
|
|
|
|
|
|
Informs the client of any change in ownership of edit lock. A value of '1'
|
|
|
|
means client can edit the document, and '0' means that client can only view
|
|
|
|
the document. This message always follows the 'status:' message after a
|
|
|
|
document is loaded, so that client has this information as soon as it loads
|
|
|
|
the document.
|
|
|
|
|
|
|
|
Note that only one client can have the editlock at a time and
|
|
|
|
others can only view.
|
|
|
|
|
2016-02-03 04:15:07 -06:00
|
|
|
error: cmd=<command> kind=<kind> [code=<error_code>]
|
2015-03-04 17:14:04 -06:00
|
|
|
<freeErrorText>
|
|
|
|
|
2015-03-19 07:38:04 -05:00
|
|
|
<command> is the command part of the corresponding client->server
|
|
|
|
message that caused the error. <kind> is some single-word
|
|
|
|
classification
|
|
|
|
|
2016-02-03 04:15:07 -06:00
|
|
|
<code> (when provided) further specifies the error as forwarded from
|
|
|
|
LibreOffice
|
|
|
|
|
2015-10-22 10:32:19 -05:00
|
|
|
getchildid: id=<id>
|
|
|
|
|
|
|
|
Returns the child id
|
|
|
|
|
2015-05-29 01:44:39 -05:00
|
|
|
invalidate: part=<partNumber> x=<x> y=<y> width=<width> height=<height>
|
|
|
|
|
|
|
|
All parameters are numbers. Tells the client to invalidate any
|
|
|
|
cached tiles for the document area specified (in twips), at any
|
|
|
|
zoom level.
|
|
|
|
|
|
|
|
The client should handle either this message or the
|
|
|
|
invalidatetiles: message, which has a different syntax, with
|
|
|
|
payload directly from the LOK_CALLBACK_INVALIDATE_TILES
|
|
|
|
callback. (The latter does not contain a part number, and as the
|
|
|
|
protocol is asynchronous, it is unclear whether a client can be
|
|
|
|
sure, or find out with certainty, for what part the
|
|
|
|
invalidatetiles: message is. The invalidatetiles: message will be
|
|
|
|
dropped soon.)
|
|
|
|
|
2015-05-28 07:25:08 -05:00
|
|
|
nextmessage: size=<byteSize>
|
|
|
|
|
|
|
|
<byteSize> is the size, in bytes, of the next message, in case it
|
2015-05-29 01:44:39 -05:00
|
|
|
is "large". (In practice, nextmessage: messages precede each tile:
|
2015-05-28 07:25:08 -05:00
|
|
|
message). Can be ignored by clients using an API that can read
|
|
|
|
arbitrarily large buffers from a WebSocket (like JavaScript), but
|
|
|
|
must be handled by clients that cannot (like those using Poco
|
2015-06-05 08:12:06 -05:00
|
|
|
1.6.0, like the "loadtest" program in the loolwsd sources).
|
2015-05-28 07:25:08 -05:00
|
|
|
|
2015-07-15 10:31:52 -05:00
|
|
|
status: type=<typeName> parts=<numberOfParts> current=<currentPartNumber> width=<width> height=<height> [partNames]
|
2015-05-28 09:55:49 -05:00
|
|
|
|
|
|
|
<typeName> is 'text, 'spreadsheet', 'presentation', 'drawing' or 'other. Others are numbers.
|
2015-07-15 10:31:52 -05:00
|
|
|
if the document has multiple parts and those have names, part names follow separated by '\n'
|
2015-05-28 09:55:49 -05:00
|
|
|
|
2015-08-18 13:01:05 -05:00
|
|
|
styles: {"styleFamily": ["styles in family"], etc. }
|
|
|
|
|
2015-09-29 05:55:21 -05:00
|
|
|
partpagerectangles: <payload>
|
|
|
|
|
|
|
|
Payload format is the same as LOK_CALLBACK_TEXT_SELECTION.
|
|
|
|
|
2015-06-24 10:08:15 -05:00
|
|
|
textselectioncontent: <content>
|
|
|
|
|
|
|
|
Current selection's content
|
|
|
|
|
2015-05-28 09:55:49 -05:00
|
|
|
tile: part=<partNumber> width=<width> height=<height> tileposx=<xpos> tileposy=<ypos> tilewidth=<tileWidth> tileheight=<tileHeight>
|
|
|
|
<binaryPngImage>
|
|
|
|
|
|
|
|
The parameters from the corresponding 'tile' command.
|
|
|
|
|
2015-03-13 04:30:45 -05:00
|
|
|
Each LOK_CALLBACK_FOO_BAR callback causes a corresponding message to
|
|
|
|
the client, consisting of the FOO_BAR part in lowercase, without
|
|
|
|
underscore, followed by a colon, space and the callback payload. For
|
|
|
|
instance:
|
|
|
|
|
2015-03-05 07:57:03 -06:00
|
|
|
invalidatecursor:
|
|
|
|
|
2015-05-28 09:55:49 -05:00
|
|
|
invalidatetiles: <payload>
|
2015-03-19 06:55:06 -05:00
|
|
|
|
|
|
|
The communication between the parent process (the one keeping open the
|
|
|
|
Websocket connections to the clients) and a child process (handling
|
|
|
|
one document through LibreOfficeKit) uses the same protocol, with
|
|
|
|
the following additions and changes:
|
|
|
|
|
2015-11-04 06:33:11 -06:00
|
|
|
unocommandresult: <payload>
|
|
|
|
|
|
|
|
Callback that an UNO command has finished.
|
|
|
|
See LOK_CALLBACK_UNO_COMMAND_RESULT for details.
|
2015-05-28 09:55:49 -05:00
|
|
|
|
2015-03-19 06:55:06 -05:00
|
|
|
child -> parent
|
|
|
|
===============
|
|
|
|
|
|
|
|
child <id>
|
|
|
|
|
2015-05-28 09:55:49 -05:00
|
|
|
Must be the first message sent from the child to the parent. The
|
|
|
|
parent has passed the id (a 64-bit random number) to the child
|
|
|
|
when starting it, so this is how the child identificates itself.
|
2015-05-18 03:21:30 -05:00
|
|
|
|
2015-05-28 10:39:05 -05:00
|
|
|
curpart: part=<partNumber>
|
|
|
|
|
|
|
|
Sent to the parent process before certain messages that the parent
|
|
|
|
needs to act on in addition to passing them on to the client, like
|
|
|
|
invalidatetiles:
|
|
|
|
|
2015-05-18 03:21:30 -05:00
|
|
|
nextmessage: size=<upperlimit>
|
|
|
|
|
2015-05-28 09:55:49 -05:00
|
|
|
each tile: message sent from the child to the parent is preceded
|
|
|
|
by a nextmessage: message that gives an upper limit on the size of
|
|
|
|
the tile: message that will follow. (We assume it is only tile:
|
|
|
|
messages that can be "large".) Once we depend on Poco 1.6.1, where
|
|
|
|
one doesn't need to use a pre-allocated buffer when receiving
|
|
|
|
WebSocket messages, this will go away.
|
2015-10-20 07:03:31 -05:00
|
|
|
|
|
|
|
saveas: url=<url>
|
|
|
|
|
|
|
|
<url> is a URL of the destination, encoded. Sent from the child to the
|
|
|
|
parent after a saveAs() completed.
|