Previous: , Up: Wire byte protocol   [Contents]


16.3.2 Special sequences sent by DomTerm to back-end

The prefix byte 0xFD is used to report an event or other information from the browser to the server. The value 0xFD is “out-of-band” because it cannot appear when encoding a string to UTF-8. If the browser needs to send an actual 0xFD, send it as the two-byte sequence "\xFD\n". (The only known way this can happen is for a large row number with the old X10 mouse reporting protocol. However, future extensions may need to send raw bytes.)

0xFD "\n"

Escape sequence to send raw 0xFD to application.

0xFD name " " data "\n"

General format for reporting events, where name is the name of the event (an identifier). The data can be any text not including a "\n" (or other control character); JSON format is used in some cases.

0xFD "WS " rows " " cols " " height " " width "\n"

Report window size from DomTerm to the back-end.

0xFD "KEY " keyname "\t" seqno "\t" kchars "\n"

Used by auto-line mode to report a key event to back-end. The keyName is an encoding of the key event in the style of browserkeymap; kchars is a string literal (JSON-formatted) of the characters that are normally transmitted to the back-end. The seqno is a sequence number, modulo 1024. In auto-line mode, if the pty is in canonical mode, then keyName is returned to DomTerm (using "\e]74;" keyName "\t" seqno "\t" kchars "\a"); otherwise kchars are sent to the pty.

0xFD "LINK " ref-info "\n"

Sent by the DomTerm browser when the user clicks on an <a> link. The ref-info is a JSON-encoded object with information about the link. The object must have at least an href property. Typically, backend should open href in the default browser of the user’s desktop, though this is contomizable.

0xFD "RECEIVED " count "\n"

This is used for flow-control. The count is the number of bytes received and processed by the front-end.

0xFD "SESSION-NAME " session-name "\n"

Set session-name (a JSON-quoted string) as the name for this session.

0xFD "DETACH\n"

Don’t destroy the session when the last window is closed; instead detach it. (Don’t necessary detach now, if there are other windows on the session.)

0xFD "FOCUSED\n"

The current (sub-)window has focus.

0xFD "WINDOW-CONTENTS " rcount "," state "\n"

Report enough of the browser part of the session state so that it can be reproduced when a window is sttached to the session. The state is a JSON-encoded structure. The rcount is similar to the value reported RECEIVED, but as of the start of the most recent urgent message.

0xFD "VERSION " version-info "\n"

Sends version-info to the back-end. Used during initialization.

0xFD "REQUEST-CLIPBOARD-TEXT" "\n"

Sent by the front-end on a Paste request when the browser doesn’t have access to clipboard. Requests the server to access the clipboard on its behalf, and send the contents using an OSC 231 sequence.

0xFD "RESPONSE" response-data "\n"

Response to a request from the server. For example, a print-stylesheet command will send a query to the browser, which sends a RESPONSE to the server, which prints the result. The response-data is a JSON object, with at least an id property (an integer matching the request, used to send the response to the right file), along with either an out property (response text to print out), or an err property (error message to print on the request process’s standard error).


Previous: Special sequences sent by back-end and handled by DomTerm, Up: Wire byte protocol   [Contents]