Changes between Version 1 and Version 2 of AnnotatedObbySession
- Timestamp:
- 05/09/06 01:01:50 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AnnotatedObbySession
v1 v2 3 3 Below is the traffic generated by a simple session between [http://dev.technomancy.us/phil/wiki/ebby Ebby] and Gobby. I've annotated it so that others who may try to implement Obby support in other editors will have an easy starting point and hints on the protocol. Lines in ''italics'' are sent by Ebby, plain lines are sent by Gobby. 4 4 5 Note that this pertains to version 0.3 of the protocol. 5 Everything the server sends consists of a command and parameters. Some commands also have subcommands, such as {{{obby_document}}} having subcommands like {{{subscribe}}}, {{{sync_line}}}, and {{{record}}}. The {{{record}}} subcommand is further divided up into {{{ins}}} and {{{del}}}. 6 7 All numbers given are in hexadecimal. 8 9 Note that this pertains to version 0.3 of the protocol. (Gobby 0.3 is rather temperamental in a few areas. Sending incorrect operation counts (see below) or positions beyond the end of the document will cause crashes. This has been fixed in 0.4.) 6 10 7 11 ''net6_client_login:phil:88ff44'' … … 11 15 {{{obby_welcome:5:2q3zg3il03:pm6vo8c81hi8a28j6ifqfhwmnwhsku7meo7gl2lyjg81ep0qwqojc6i6lygfb2el5lxr8smhg2lufjxxgd0iyno9vn88naikemz:4d}}} 12 16 13 The server responds with an obby_welcomecommand, the version of the protocol it supports, and (I believe) an RSA authentication.17 The server responds with an {{{obby_welcome}}} command, the version of the protocol it supports, and (I believe) an RSA authentication. 14 18 15 19 {{{obby_sync_init:5}}} … … 29 33 I believe this represents other users who may have edited existing documents, but are no longer connected. 30 34 31 {{{obby_sync_doclist_document:1:1:a:1 35 {{{obby_sync_doclist_document:1:1:a:1}}} 32 36 33 obby_sync_doclist_document:1:2:b:1}}}37 {{{obby_sync_doclist_document:1:2:b:1}}} 34 38 35 The server then sends a list of every open document. Each document is identified by a pair of numbers: one for the obby user id of the creator, and one for the per-user index of the document. (User #2's first document would be "2 1", their second "2 2", etc.) The fields here are creator's user id, creator document index, document name, and a list of users currently subscribed to the document. The server may also notify the client of new documents created by sending {{{obby_document_create}}} with the same parameters.39 The server then sends a list of every open document. Each document is identified by a pair of numbers: one for the obby user id of the creator, and one for the per-user index of the document. (User 2's first document would be "2 1", their second "2 2", etc.) The fields here are creator's user id, creator document index, document name, and a list of users currently subscribed to the document. The server may also notify the client of new documents created by sending {{{obby_document_create}}} with the same parameters. 36 40 37 41 {{{obby_sync_final}}} … … 47 51 The server tells the client how many lines there are in the document. 48 52 49 {{{obby_document:1 1:sync_line:jibbery jabbery:0:1 53 {{{obby_document:1 1:sync_line:jibbery jabbery:0:1}}} 50 54 51 obby_document:1 1:sync_line: this is also cool. :0:3:7:1 55 {{{obby_document:1 1:sync_line: this is also cool. :0:3:7:1}}} 52 56 53 obby_document:1 1:sync_line:another line here.:0:1}}}57 {{{obby_document:1 1:sync_line:another line here.:0:1}}} 54 58 55 Each line is sent. The numbers after the line indicate who authored it. On the second line, it says :0:3:7:1. This indicates that the first chunk of the line (starting at position 0) was authored by user #3, while the second chunk of the line (starting at position 7) was authored by user #1.59 Each line is sent. The numbers after the line indicate who authored it. On the second line, it says :0:3:7:1. This indicates that the first chunk of the line (starting at position 0) was authored by user 3, while the second chunk of the line (starting at position 7) was authored by user 1. 56 60 57 61 {{{obby_document:1 1:subscribe:2}}} 58 62 59 63 The server is done sending lines, and the client is considered subscribed. 60 61 64 62 65 ''obby_document:1 1:record:0:0:ins:37:s'' … … 70 73 ''obby_document:1 1:record:4:0:ins:3b: '' 71 74 72 obby_document:1 1:record:1:0:5:ins:3c:r 75 Here is an instance of the {{{record}}} subcommand. Our client has just entered the word 'sent ' and transmitted it to the server. The numbers in between {{{record}}} and {{{ins}}} are the local and remote operation counts. Every time the client makes a modification to the document, the local operation count should increase. Every time the server transmits a change, the client should increase its remote operation count. The number right after {{{ins}}} is the position at which the character should be inserted. 73 76 74 obby_document:1 1:record:1:1:5:ins:3d:e 77 {{{obby_document:1 1:record:1:0:5:ins:3c:r}}} 75 78 76 obby_document:1 1:record:1:2:5:ins:3e:c 79 {{{obby_document:1 1:record:1:1:5:ins:3d:e}}} 77 80 78 obby_document:1 1:record:1:3:5:ins:3f:e 81 {{{obby_document:1 1:record:1:2:5:ins:3e:c}}} 79 82 80 obby_document:1 1:record:1:4:5:ins:40:i 83 {{{obby_document:1 1:record:1:3:5:ins:3f:e}}} 81 84 82 obby_document:1 1:record:1:5:5:ins:41:v 85 {{{obby_document:1 1:record:1:4:5:ins:40:i}}} 83 86 84 obby_document:1 1:record:1:6:5:ins:42:e 87 {{{obby_document:1 1:record:1:5:5:ins:41:v}}} 85 88 86 obby_document:1 1:record:1:7:5:ins:43:d 89 {{{obby_document:1 1:record:1:6:5:ins:42:e}}} 90 91 {{{obby_document:1 1:record:1:7:5:ins:43:d}}} 92 93 Note that when the server sends insertions, the position of the local operation count and remote operation count is reversed. Here a remote user just typed the word 'received' at a position right after our client typed 'sent '. Note that if the client were to transmit something at this point, '''it should sent 8''' as the remote operation count, not 7. This is because every received modification should increase the remote operation count to one greater than what the message indicating the change shows. 94 95 {{{obby_document:1 1:record:1:8:15:del:23:1}}} 96 97 Here the server informs the client that a deletion has occurred with a {{{del}}}. Apart from the operation count information directly proceeding the {{{record}}} subcommand, the final two parameters indicate the position the deletion began as well as the length of the deletion. 98 99 {{{obby_document:1 1:record:1:9:15:del:3c:8}}} 100 101 Here a whole 8 characters have been deleted, from 0x3c to 0x44.
