WebCollab: Difference between revisions

Bemasc (talk | contribs)
Bemasc (talk | contribs)
No edit summary
Line 24: Line 24:
A message in JSCollab has a key, a value, and an index.  The key is a string subject to the same constraints as the unique id.  The value is a sequence of arbitrary bytes.  The index is an integer indicating the number of messages previously sent by the user, incremented for each message, starting at 0.
A message in JSCollab has a key, a value, and an index.  The key is a string subject to the same constraints as the unique id.  The value is a sequence of arbitrary bytes.  The index is an integer indicating the number of messages previously sent by the user, incremented for each message, starting at 0.


To broadcast a message, a JSCollab client uploads a file with the name {unique id}_broadcast_{index}_{key}.  The contents of the file are the value of the message.  The index is represented as a base-10 string.
To broadcast a message, a JSCollab client uploads a file with the name broadcast_{unique id}_{index}_{key}.  The contents of the file are the value of the message.  The index is represented as a base-10 string.


To send a message to a specific user specified by a target id, the client uploads a file with the name {unique id}_to_{target id}_{index}_{key}
To send a message to a specific user specified by a target id, the client uploads a file with the name to_{target id}_{unique id}_{index}_{key}


For efficiency reasons, it may sometimes be appropriate to delete messages.  A client may delete messages using the HTTP DELETE command.  Because messages always have unique names, and are immutable, there is no risk of races between a client deleting a file and another client creating a file with the same name or updating the existing file.
For efficiency reasons, it may sometimes be appropriate to delete messages.  A client may delete messages using the HTTP DELETE command.  Because messages always have unique names, and are immutable, there is no risk of races between a client deleting a file and another client creating a file with the same name or updating the existing file.