$session->connect_client VISUAL, STATE
This is the JS accessible version of the login which returns a JS string to set up the connection.
Also sends the diffs from STATE to the current state if
STATE is 0 or
STATE is -1 then no updates are sent as the client is expected to retrieve the complete document via
Returns the user if the cookie is a valid cookie for this session. See also Zaphod::Session::valid_cookie
CLIENT as a
new User() JS statement,
Removes the client from the session
$session->users CLIENT, OFS, STATE
Also returns any new actions that happened since
TODO: All of
document and whatnot should be rolled into two structures,
one input and one output structure.
Returns a JS statement to assign the document.
TODO: The "current" document should be a
text/plain document that can be retrieved partially to speed up the handling/editing of large documents.
$session->set_name CLIENT, STATE, NEWNAME
Sets the name of the current session, permissions provided.
The new name will be broadcast to the other clients. The name change is currently out-of-band with the editor, so there is no undo/redo functionality for it.
$session->js_response RESPONSE, @code
Returns the statements wrapped as a JS response.
Always prepends a timestamp to the
timestamp JS variable.
TODO: The client could check/maintain the time of the last response itself.
$sesion->actions CLIENT, STATE, ACTIONSTRING
Takes a string of actions, reconciles them with the parallel other actions, and returns JS code to update the client positions and to replace the submitted actions. Also returns code to update the client state number.
TODO: Currently knows too much about the underlying
Separate the functionalities.
Helper method to generate quoted JS strings.
The nonprintable or special characters will be escaped by using backslashes and hexadecimal notation (
TODO: Use a standard (JSON?) method instead of hand-rolling my own.
Converts all the arguments from ISO-8859-1 to utf8.