SynchronizedProtocol

From SynchroEdit

(Difference between revisions)
Jump to: navigation, search
Revision as of 19:11, 30 May 2006 (edit)
Kalle Alm (Talk | contribs)

← Previous diff
Revision as of 19:12, 30 May 2006 (edit)
Kalle Alm (Talk | contribs)

Next diff →
Line 14: Line 14:
=== Definitions === === Definitions ===
- // DOM Node defines:+ // DOM Node defines:
- const NT_ELEMENT_NODE = 1; // Node.ELEMENT_NODE + const NT_ELEMENT_NODE = 1; // Node.ELEMENT_NODE
- const NT_ATTRIBUTE_NODE = 2; // Node.ATTRIBUTE_NODE + const NT_ATTRIBUTE_NODE = 2; // Node.ATTRIBUTE_NODE
- const NT_TEXT_NODE = 3; // Node.TEXT_NODE + const NT_TEXT_NODE = 3; // Node.TEXT_NODE
- const NT_DOCUMENT_NODE = 4; // Node.DOCUMENT_NODE + const NT_DOCUMENT_NODE = 4; // Node.DOCUMENT_NODE
=== Protocol specification === === Protocol specification ===

Revision as of 19:12, 30 May 2006

Contents

Interface implementation "SynchronizedProtocol":

Revision 7 (May 30, 2006)

Note

This specification does not take into consideration such things as logging in/identifying oneself on the server-system.

Changelog

Revision    Date            Description
4           Aug 16, 2005    Added ELA command, for attribute changes.
5           Jan 31, 2006    Added PAUSE and RECONNECT.
6           Feb 21, 2006    Added EMAIL.
7           May 30, 2006    Added CHAT.

Definitions

// DOM Node defines:
const NT_ELEMENT_NODE   = 1; // Node.ELEMENT_NODE 
const NT_ATTRIBUTE_NODE = 2; // Node.ATTRIBUTE_NODE 
const NT_TEXT_NODE      = 3; // Node.TEXT_NODE 
const NT_DOCUMENT_NODE  = 4; // Node.DOCUMENT_NODE 

Protocol specification

General:

  • All commands are separated by line-feed.
  • Some commands' parameters may include line-feeds; these commands should wrap the entire parameter content in [] brackets.
  • All commands from server-to-client which originate from another client should have the client's UID (user ID) as its first argument, followed by any (if any) command arguments.
  • All commands should be prefixed with the DocumentStateSequence, even if the DocumentStateSequence is currently unset (-1), and even if the command is DSS-insensitive. DSS-announcements server-to-client should always have the DSS sequence -1, regardless of document state.

Protocol

Client-to-server specification

            Command:                        UP [charcount] [content]
                int    [charcount]          # of characters in transmission
                string [content]            the content to update with
            DSS-sensitive:                  No.
            Description:                    Update the currently edited node.

            Command:                        SET [node-identifier] [charcount] [content]
                string [node-identifier]    the node to update
                int    [charcount]          # of characters in transmission
                string [content]            the content to update with
            DSS-sensitive:                  Yes.
            Description:                    Update the specified node and move the node-pointer.

            Command:                        NODE [node-identifier]
                string [node-identifier]    the node to move to
            DSS-sensitive:                  Yes.
            Description:                    Move the node-pointer to a new node.

            Command:                        REM [node-identifier]
                string [node-identifier]    the node to remove
            DSS-sensitive:                  Yes.
            Description:                    Remove a node.

            Command:                        INS [node-identifier] [node-type] [element-tag] [temp-id] [charcount] [content]
                string [node-identifier]    new node's identifier
                int [node-type]             the NT_* value of this node's type
                string [element-tag]        element tag name (only when [node-type]==1)
                string [temp-id]            temporary id (only when [node-type]==1)
                int    [charcount]          # of characters in transmission
                string [content]            the content to update with
            DSS-sensitive:                  Yes.
            Description:                    Insert a new node.

            Command:                        ELA [element-id] [attribute-id] [charcount] [attribute-value]
                string [element-id]         The element ID, which can be obtained using the DOM
                                            getElementById(), or using the Node.getAttribute("id")
                string [attribute-id]       The attribute which is to be changed.
                int    [charcount]          # of characters in transmission
                string [attribute-value]    The value to set the attribute to.
            DSS-sensitive:                  No.
            Description:                    Set or add an attribute to an element.
        
            Command:                        PAUSE
            DSS-sensitive:                  No.
            Description:                    Ask the server to start buffering updates for the client and
                                            to tell the client to reconnect.
        
            Command:                        COLOR [htmlRgb]
                string [htmlRgb]            New color.
            DSS-sensitive:                  No.
            Description:                    Tell the server we have a new color.
        
            Command:                        EMAIL [address]
                string [address]            User's email address.
            DSS-sensitive:                  No.
            Description:                    Tell the server user's email address.
        
            Command:                        CHAT [message]
                string [message]            A message.
            DSS-sensitive:                  No.
            Description:                    Send a message to the in-client chat pane.

Server-to-client specification

            Command:                        RECONNECT
            DSS-sensitive:                  No.
            Description:                    Ask the client to reconnect to the server.

            Command:                        ID [old-id] [new-id]
                string [old-id]             the node-identifier of the node that should be renamed
                string [new-id]             the new element ID of the resulting element
            DSS-sensitive:                  No.
            Definition:                     private-response
            Description:                    Identify an element node, effectively making it an anchor.

            Command:                        UP [uid] [charcount] [content]
                string [uid]                user ID
                int    [charcount]          # of characters in transmission
                string [content]            the content to update with
            DSS-sensitive:                  No.
            Definition:                     announcement
            Description:                    Update the currently edited node.

            Command:                        SET [uid] [node-identifier] [charcount] [content]
                string [uid]                user ID
                string [node-identifier]    the node to update
                int    [charcount]          # of characters in transmission
                string [content]            the content to update with
            DSS-sensitive:                  Yes.
            Definition:                     announcement
            Description:                    Update the specified node and move the node-pointer.

            Command:                        NODE [uid] [node-identifier]
                string [uid]                user ID
                string [node-identifier]    the node to move to
            DSS-sensitive:                  Yes.
            Definition:                     announcement
            Description:                    Move the node-pointer to a new node.

            Command:                        REM [uid] [node-identifier]
                string [uid]                user ID
                string [node-identifier]    the node to remove
            DSS-sensitive:                  Yes.
            Definition:                     announcement
            Description:                    Remove a node.

            Command:                        INS [uid] [node-identifier] [node-type] [element-tag] [element-id] [charcount] [content]
                string [uid]                user ID
                string [parent-identifier]  new node identifier
                int [node-type]             the NT_* value of this node's type
                string [element-tag]        element tag name (only when [node-type]==1)
                string [element-id]         element identifier (only when [node-type]==1)
                int    [charcount]          # of characters in transmission
                string [content]            the content to update with
            Definition:                     announcement
            Description:                    Insert a new node.

            Command:                        ELA [uid] [element-id] [attribute-id] [charcount] [attribute-value]
                string [uid]                user ID
                string [element-id]         The element ID, which can be obtained using the DOM
                                            getElementById(), or using the Node.getAttribute("id")
                string [attribute-id]       The attribute which is to be changed.
                int    [charcount]          # of characters in transmission
                string [attribute-value]    The value to set the attribute to.
            DSS-sensitive:                  No.
            Description:                    Set or add an attribute to an element.

            Command:                        DSSA [dss]
                int [dss]                   DSS sequence relative correction
            Definition:                     private-announce
            Description:                    Document State Sequence Announcement. The [dss] integer is a signed relative correction (most probably a 
                                            positive number) defining the DSS out-of-syncness of the client.
        
            Command:                        CHAT [uid] [message]
                string [message]            A message.
            DSS-sensitive:                  No.
            Description:                    Display a message from [uid] in the in-client chat pane.

Use cases

The use cases here were deemed misleading as they do not currently represent the current implementation of SynchroEdit and thus have been removed.

Personal tools