On Aug 12, 2:49 am, Joe Walker <
jwal...@mozilla.com> wrote:
> The Mozilla version of mobwrite adds the following:
> h/H: Handle. A username:ip-addr combination, 'client' header but added
> by the server, so it can be trusted. Needed to handle non world-write
> access.
> C: Collaborators. Server added header informing the client of handles
> of other clients collaborating on the file.
> x/X: Close view. The client may be able to tell the server to close a
> view, reducing memory consumption, and allowing more accurate display
> of collaborators.
> E: Error: Server added header informing the client of a failure
> condition.
> O: Read Only: Server added to inform the client that access to the
> given file is read-only. Attempts to alter it will be ignored.
> S: Save state: The mobwrite version of the file is not considered
> 'final' until saved. This server added header informs clients if the
> file has changed since editing. (Planned, not implemented)
> q: Debug. This is a temporary fix to allow additional debug to be
> displayed on the server console.
I'm *finally* able to start work on the status functionality
(conflicting internal priorities here at Google got in the way). The
idea is for each client to optionally submit some status information
along with their regular sync. The server would rebroadcast this
information to other clients. Thus a client could add a coloured
marker in the text to represent a collaborator's cursor or selection.
Next to your scrollbar could be a display showing where collaborators
are looking within the document. A nickname for each collaborator
could be displayed so that you know "is anybody there?". Likewise
their current idle time could be displayed so you know if they are out
to lunch.
The format I had envisioned:
S: {"cursor":27,"top":7,"bottom":50,"user":'"Neil Fraser","idle":
120,"msg":"Out to lunch"}
None of these fields would be trusted, none would be required, no
delivery is guaranteed. From the server's point of view the whole
{...} is an opaque block to to be received, stored temporarily and
replayed to other clients. From the clients' point of view it's a
JSON object with arbitrary parameters. Conventions would be needed to
support these parameters, here are some suggestions:
* 'cursor' would indicate the number of characters from the start of
the document to the cursor.
* 'top', 'bottom', 'left' and 'right' would be the offset in
characters (left/right) or lines (top/bottom) from the upper-left
which describes what is currently visible to the user.
* 'select' would indicate the offset location from cursor for where
the current selection ends. Thus for the string "my cat", {cursor:
6,select:-3} would indicate the cursor is at the end of the string and
'cat' is selected. if 'select' is absent or 0, there is no selection.
* 'user' is a human-readable name of the human user.
* 'idle' is the number of seconds since the user interacted with the
document. (Does this mean mouse movement, cursoring, or diff finding
a local change?)
* 'msg' is a user-provided status message, like in Google Chat.
* 'foo-bar' is a namespace convention where rich client 'foo' has a
message of type 'bar' it wishes to send, without worrying that some
other client has defined an incompatible extension using the same
name. E.g. 'moz-temerature'.
If the client sends "S: {...}", it is submitting a status message and
it requests in response all the status messages from other clients.
If the client sends "s: {...}" it is submitting a status message, but
does not require receipt of messages from other clients. If the
client sends nothing, it will get nothing.
The server would have an internal timeout (default: one minute) after
which it will discard and stop rebroadcasting a client's last status
message if it has not heard from the client in that time. A courteous
client would send a null "s:" to the server on disconnect to indicate
its departure.
Just to be totally clear, this status line is COMPLETELY OPTIONAL.
Even if supported, which of the above fields are read or written is
also completely up to the author. It enables richer clients to
exchange information between each other. The non-existence of this
functionality is fine, there are no reverse-compatibility issues with
having a client which supports this and a server which does not, or
vice versa, or a mixture of supporting and non-supporting clients.
Joe, you mentioned that Bespin has already implemented this, so since
you are the first-mover I'd like to maintain compatibility with your
implementation. But I don't see this field in the protocol extensions
listed above. Could you give me a spec for such a field if you have
one?