Parser 2011/Real-time-collaboration/EtherPadWebApi
This page is obsolete. It is being retained for archival purposes. It may document extensions or features that are obsolete and/or no longer supported. Do not rely on the information here being up-to-date. |
Opening a session
edit?? Establishes comet API—tries three "coment/channel" requests, one channel=shortpolling, another streaming, then shortpolling again
?? http://204568131128.comet.etherpad.wikimedia.org/comet/xhrXdFrame—assumes wildcard DNS is available??
m:{ "type":"COLLABROOM", "data":{ "type":"CLIENT_READY", "roomType":"padpage", "roomName":"padpage/PiCvlh2WAJ", "data":{ "lastRev":0, "userInfo": { "userId":"g.nrrwxp0egigiulep", "name":"Neil", "ip":"127.0.0.1", "colorId":19, "userAgent":"Chrome12.0.742.1" }, "stats":{ "screen":"1483,363,1920,1126,1920,1200", "ip":"127.0.0.1", "useragent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30" } } } }
Press return once in the doc
Query stirng: r:998659282690 v:2 id:541001861914 seq:1 Form Data m:{ "type":"COLLABROOM", "data":{ "type":"USER_CHANGES", "baseRev":0, "changeset":"Z:54>1|2=r=4a*0|1 1$\n", "apool":{ "numToAttrib":{ "0":["author","g.nrrwxp0egigiulep"] }, "nextNum":1 } } }
Type WIKI at position 0
queryargs r:355348323705 v:2 id:541001861914 seq:14 postargs m:{"type":"COLLABROOM","data":{"type":"USER_CHANGES","baseRev":13,"changeset":"Z:56>1*0 1$W","apool":{"numToAttrib":{"0":["author","g.nrrwxp0egigiulep"]},"nextNum":1}}} ----- queryargs r:645610667299 v:2 id:541001861914 seq:15 postargs m:{"type":"COLLABROOM","data":{"type":"USER_CHANGES","baseRev":14,"changeset":"Z:57>3=1*0 3$IKI","apool":{"numToAttrib":{"0":["author","g.nrrwxp0egigiulep"]},"nextNum":1}}}
In all cases the server response is a simple "ok"
Typing "QUORBAL" at position 5
r:911135458620 v:2 id:541001861914 seq:18 m:{"type":"COLLABROOM","data":{"type":"USER_CHANGES","baseRev":15,"changeset":"Z:5a>1=4*0 1$Q","apool":{"numToAttrib":{"0":["author","g.nrrwxp0egigiulep"]},"nextNum":1}}} ---- r:311440908816 v:2 id:541001861914 seq:19 m:{"type":"COLLABROOM","data":{"type":"USER_CHANGES","baseRev":16,"changeset":"Z:5b>3=5*0 3$UOR","apool":{"numToAttrib":{"0":["author","g.nrrwxp0egigiulep"]},"nextNum":1}}} ---- r:336653723381 v:2 id:541001861914 seq:20 Form Dataview URL encoded m:{"type":"COLLABROOM","data":{"type":"USER_CHANGES","baseRev":17,"changeset":"Z:5e>2=8*0 2$BA","apool":{"numToAttrib":{"0":["author","g.nrrwxp0egigiulep"]},"nextNum":1}}} ---- r:684775243048 v:2 id:541001861914 seq:21 Form Dataview URL encoded m:{"type":"COLLABROOM","data":{"type":"USER_CHANGES","baseRev":18,"changeset":"Z:5g>1=a*0 1$L","apool":{"numToAttrib":{"0":["author","g.nrrwxp0egigiulep"]},"nextNum":1}}}
Receiving end—streaming, requires Wireshark to follow these
10 13:oob:keepalive 1d2 462:3:0:{"type":"COLLABROOM","data":{"changeset":"Z:5a>1=4*0+1$Q","newRev":16,"type":"NEW_CHANGES","author":"g.nrrwxp0egigiulep","apool":{"getAttrib":{"prototype":{}},"getAttribKey":{"prototype":{}},"putAttrib":{"prototype":{}},"fromJsonable":{"prototype":{}},"eachAttrib":{"prototype":{}},"getAttribValue":{"prototype":{}},"toJsonable":{"prototype":{}},"nextNum":1,"attribToNum":{"author,g.nrrwxp0egigiulep":0},"numToAttrib":{"0":["author","g.nrrwxp0egigiulep"]}}}} 1d4 464:4:0:{"type":"COLLABROOM","data":{"changeset":"Z:5b>3=5*0+3$UOR","newRev":17,"type":"NEW_CHANGES","author":"g.nrrwxp0egigiulep","apool":{"getAttrib":{"prototype":{}},"getAttribKey":{"prototype":{}},"putAttrib":{"prototype":{}},"fromJsonable":{"prototype":{}},"eachAttrib":{"prototype":{}},"getAttribValue":{"prototype":{}},"toJsonable":{"prototype":{}},"nextNum":1,"attribToNum":{"author,g.nrrwxp0egigiulep":0},"numToAttrib":{"0":["author","g.nrrwxp0egigiulep"]}}}} 1d3 463:5:0:{"type":"COLLABROOM","data":{"changeset":"Z:5e>2=8*0+2$BA","newRev":18,"type":"NEW_CHANGES","author":"g.nrrwxp0egigiulep","apool":{"getAttrib":{"prototype":{}},"getAttribKey":{"prototype":{}},"putAttrib":{"prototype":{}},"fromJsonable":{"prototype":{}},"eachAttrib":{"prototype":{}},"getAttribValue":{"prototype":{}},"toJsonable":{"prototype":{}},"nextNum":1,"attribToNum":{"author,g.nrrwxp0egigiulep":0},"numToAttrib":{"0":["author","g.nrrwxp0egigiulep"]}}}} 1d2 462:6:0:{"type":"COLLABROOM","data":{"changeset":"Z:5g>1=a*0+1$L","newRev":19,"type":"NEW_CHANGES","author":"g.nrrwxp0egigiulep","apool":{"getAttrib":{"prototype":{}},"getAttribKey":{"prototype":{}},"putAttrib":{"prototype":{}},"fromJsonable":{"prototype":{}},"eachAttrib":{"prototype":{}},"getAttribValue":{"prototype":{}},"toJsonable":{"prototype":{}},"nextNum":1,"attribToNum":{"author,g.nrrwxp0egigiulep":0},"numToAttrib":{"0":["author","g.nrrwxp0egigiulep"]}}}} 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 1d2 462:7:0:{"type":"COLLABROOM","data":{"changeset":"Z:5h>1=b*0+1$Z","newRev":20,"type":"NEW_CHANGES","author":"g.nrrwxp0egigiulep","apool":{"getAttrib":{"prototype":{}},"getAttribKey":{"prototype":{}},"putAttrib":{"prototype":{}},"fromJsonable":{"prototype":{}},"eachAttrib":{"prototype":{}},"getAttribValue":{"prototype":{}},"toJsonable":{"prototype":{}},"nextNum":1,"attribToNum":{"author,g.nrrwxp0egigiulep":0},"numToAttrib":{"0":["author","g.nrrwxp0egigiulep"]}}}} 1d4 464:8:0:{"type":"COLLABROOM","data":{"changeset":"Z:5i>3=c*0+3$ACH","newRev":21,"type":"NEW_CHANGES","author":"g.nrrwxp0egigiulep","apool":{"getAttrib":{"prototype":{}},"getAttribKey":{"prototype":{}},"putAttrib":{"prototype":{}},"fromJsonable":{"prototype":{}},"eachAttrib":{"prototype":{}},"getAttribValue":{"prototype":{}},"toJsonable":{"prototype":{}},"nextNum":1,"attribToNum":{"author,g.nrrwxp0egigiulep":0},"numToAttrib":{"0":["author","g.nrrwxp0egigiulep"]}}}} 1d4 464:9:0:{"type":"COLLABROOM","data":{"changeset":"Z:5l>3=f*0+3$ARY","newRev":22,"type":"NEW_CHANGES","author":"g.nrrwxp0egigiulep","apool":{"getAttrib":{"prototype":{}},"getAttribKey":{"prototype":{}},"putAttrib":{"prototype":{}},"fromJsonable":{"prototype":{}},"eachAttrib":{"prototype":{}},"getAttribValue":{"prototype":{}},"toJsonable":{"prototype":{}},"nextNum":1,"attribToNum":{"author,g.nrrwxp0egigiulep":0},"numToAttrib":{"0":["author","g.nrrwxp0egigiulep"]}}}} 1da 470:10:0:{"type":"COLLABROOM","data":{"changeset":"Z:5o>a*0+a$STRAWBERRY","newRev":23,"type":"NEW_CHANGES","author":"g.nrrwxp0egigiulep","apool":{"getAttrib":{"prototype":{}},"getAttribKey":{"prototype":{}},"putAttrib":{"prototype":{}},"fromJsonable":{"prototype":{}},"eachAttrib":{"prototype":{}},"getAttribValue":{"prototype":{}},"toJsonable":{"prototype":{}},"nextNum":1,"attribToNum":{"author,g.nrrwxp0egigiulep":0},"numToAttrib":{"0":["author","g.nrrwxp0egigiulep"]}}}} 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive 10 13:oob:keepalive
Observations
editPosting text typed
editQuery args
editr is a random integer, just to ensure lack of caching
id is unchanging; may refer to document
v is always 2; probably protocol version
seq a monotonically increasing number, presumably referring to communication sequence number
Post args
editPosted JSON object. Keys:
m Message? Is always there.
- type always COLLABROOM
- data another object
- type always USER_CHANGES
- baseRev monotonically increasing (perhaps would not be with undos)
- changeset string with complicated formatting here, defining the user changes. See below
- apool: JSON object
- 0: JSON array
- 0 -> author
- 1 -> id that remains constant
- 0: JSON array
- nextnum always 1, so far
changeset format
editZ:5b>3=5*0 3$UOR
Z: unchanging. ???
colon: separator?
5b: monotonically increasing hex number
> separator?
3: character change length
equals sign: separator
5: offset where this insertion starts
star: may mean 'insertion'
0: doesn't change, not sure
space: separator
3: length again. May refer to the length expected after transformation applied, e.g. this insertion causes change in length from 0->3
dollar: separator
UOR: actual content
Save revision
editPOSTetherpad:ep: padId:PiCvlh2WAJ
- savedBy:Neil
- savedById:g.nrrwxp0egigiulep
- revNum:24
returns 200 OK:
[{"id":"ADz6G2T9gr","timestamp":1309560987757,"revNum":"24","savedById":"g.nrrwxp0egigiulep","label":"Revision 1","savedBy":"Neil"}]
What is the relation between the padId and the Id we've seen in the other ones, 541001861914 ? If any? Doesn't seem to be base64, that would be NTQxMDAxODYxOTE0Cg==
Undo
editm:{"type":"COLLABROOM","data":{"type":"USER_CHANGES","baseRev":24,"changeset":"Z:6a<m-m$","apool":{"numToAttrib":{},"nextNum":0}}}
Redo
editm:{"type":"COLLABROOM","data":{"type":"USER_CHANGES","baseRev":31,"changeset":"Z:5o>m*0 m$zacharyzzzraSTRAWBERRY","apool":{"numToAttrib":{"0":["author","g.nrrwxp0egigiulep"]},"nextNum":1}}}
Note baseRev is still increasing, however Z has gone to 5o.
surprisingly it also explains how to do the redo, with text?
Change pad options
edite.g. to monospace
m:{"type":"COLLABROOM","data":{"type":"CLIENT_MESSAGE","payload":{"type":"padoptions","options":{"view":{"useMonospaceFont":true}},"changedBy":"Neil"}}}