No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0113.xml 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM "xep.ent">
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>Simple Whiteboarding</title>
  10. <abstract>A proposal for an extremely simple whiteboarding protocol over Jabber.</abstract>
  11. &LEGALNOTICE;
  12. <number>0113</number>
  13. <status>Deferred</status>
  14. <type>Informational</type>
  15. <sig>Standards</sig>
  16. <dependencies/>
  17. <supersedes/>
  18. <supersededby/>
  19. <shortname>Not yet assigned</shortname>
  20. <author>
  21. <firstname>Huib-Jan</firstname>
  22. <surname>Imbens</surname>
  23. <email>jabber@imbens.nl</email>
  24. <jid>imbens@jabber.org</jid>
  25. </author>
  26. <revision>
  27. <version>0.2</version>
  28. <date>2003-09-07</date>
  29. <initials>hji</initials>
  30. <remark>Added optional stroke, stroke-width and id attributes to the path element; added move and delete elements; added remark on Coccinella protocol and tkabber to introduction; added explanation about text-drawing and clear-screen discussion to implementation notes.</remark>
  31. </revision>
  32. <revision>
  33. <version>0.1</version>
  34. <date>2003-08-26</date>
  35. <initials>hji</initials>
  36. <remark>Initial version.</remark>
  37. </revision>
  38. </header>
  39. <section1 topic='Introduction'>
  40. <p>As explained in the now obsolete XEP-0010: Whiteboarding <note>XEP-0010: Whiteboarding SIG <link url="http://www.xmpp.org/extensions/xep-0010.html">http://www.xmpp.org/extensions/xep-0010.html</link></note>: "Jabber is often thought of simply as a system for instant messaging, albeit an open one. However, Jabber technology can be used, and is being used, in applications quite different from simple IM. One of these applications is whiteboarding. In collaborative work, the ability to draw (for example, to design sketches, UML schemas, house architectures, and organizational plans) is essential, as exemplified by the success of real-world whiteboarding applications such as Microsoft NetMeeting. Whiteboarding can also be used for entertainment purposes such as games and quizzes. Because of the value of whiteboarding as an important real-time collaboration tool, other IM services are beginning to offer these capabilities. For these and other reasons, I believe that a good protocol for whiteboarding in Jabber would be of great value".</p>
  41. <p>The increasing penetration of pen-based devices, such as PDAs and tablet PCs, makes the need for a protocol that allows for sending freehand drawing information more urgent.</p>
  42. <p>Several attempts have been made to create a whiteboarding protocol for Jabber:</p>
  43. <ol>
  44. <li>Collaborative Imaging (Whiteboarding via Streaming XPM) describes a protocol that sends partial bitmaps. This protocol is not suitable for freehand drawing and has not been implemented.</li>
  45. <li>Jabber Whiteboarding using SVG <note>Jabber Whiteboarding using SVG <link url="http://www.protocol7.com/jabber/whiteboard_proposal.txt">http://www.protocol7.com/jabber/whiteboard_proposal.txt</link></note> describes a protocol that uses a subset of SVG. It refers to a missing DTD that describes the precise subset, but there is little doubt that that subset will be hard to implement. This protocol has not been implemented.</li>
  46. <li>The Coccinella client includes an open source implementation of a whiteboarding protocol. However, the protocol has not been documented and does not seem easy to implement. In fact it is mostly raw TCL, making an implementation of that protocol in a language other than TCL rather difficult.</li>
  47. <li>The Tkabber client has a whiteboard plugin. The protocol has not been documented, but it uses a subset of SVG, similar to the one defined in this document.</li>
  48. </ol>
  49. </section1>
  50. <section1 topic='Requirements'>
  51. <p>The protocol has the following requirements in order of importance:</p>
  52. <ol>
  53. <li>It should allow for freehand drawing because that will be its principal use on pen-based devices.</li>
  54. <li>It should be extremely easy to implement to ensure its rapid adaptation.</li>
  55. <li>It should be light-weight.</li>
  56. <li>It should not require server modifications.</li>
  57. </ol>
  58. <p>The following are definitely not objectives of the protocol:</p>
  59. <ol>
  60. <li>It need not be complete. Eventually an SVG-based protocol will be defined that will either replace or coexist with this protocol and that will satisfy all drawing needs. However, given the history of whiteboarding protocols, such a protocol is far away.</li>
  61. <li>It need not be extensible. As a "Simple Whiteboarding protocol" it should not try to grow into a more complex protocol that would be more difficult to implement.</li>
  62. </ol>
  63. </section1>
  64. <section1 topic='Use Cases'>
  65. <p>There are three scenarios where whiteboarding can be used:</p>
  66. <ul>
  67. <li>One person sends a single, completed, whiteboard to another person.</li>
  68. <li>The more typical scenario is the one where one person starts a whiteboard session with another person and both persons collaborate in the drawing. Both sides may add paths, move them around or delete them.</li>
  69. <li>Finally multiple people gathered in a conference room can use single whiteboard.</li>
  70. </ul>
  71. <section2 topic='Single whiteboard message'>
  72. <p>Typically the user right-clicks on the destination contact and will select a "whiteboard message" option. The client will show a dialog where the user can create the drawing. It is up to the implementation to decide whether the user can include text in the message as well. Upon clicking a send button the client will close the dialog and send the following message:</p>
  73. <example caption='Single whiteboard message'><![CDATA[
  74. <message
  75. from='painter@shakespeare.lit'
  76. to='timon@shakespeare.lit/hall'>
  77. <body>A piece of painting, which I do beseech your lordship to accept.</body>
  78. <x xmlns='http://jabber.org/protocol/swb'>
  79. <path d='M 100 100 L 300 100 200 300 100 100' stroke='#ff0000' stroke-width='1' id='painter1'/>
  80. </x>
  81. </message>
  82. ]]></example>
  83. <p>The path node is a simplified SVG path node that allows only 'M', 'm', 'L' and 'l' commands. 'M' ('m') command is a (relative) moveto command, 'L' ('l') is a (relative) lineto command. All four commands take one or more coordinate pairs (in pixels). 'M' sets the current point to the coordinate pair. 'm' adds the coordinate pair to the current point. 'L' draws a line from the current point to the point designated by the coordinate pair and sets the current point to the coordinate pair. 'l' draws a line from the current point to the sum of the currentpoint and the coordinate pair and adds the coordinate pair to the current point. The optional stroke attribute indicates the color of the path and defaults to black, the optional stroke-width indicates the width of the path in pixels and defaults to 1. The id attribute can be used for later reference to the path. If there is no id attribute, the path can not be referred to.</p>
  84. <p>The path in example 1, draws a red triangle with vertices (100,100), (300,100) and (200, 300)</p>
  85. <p>Other respresentations of the same path are 'M100.0,100.0L300.0,100.0,200.0,300.0,100.0,100.0', 'M100,100l200,0-100,200-100-200' and 'M100,100l200,0L200,300,100,100'. Note that in the second representation some commas can be left out because the sign indicates that a new coordinate is starting. This fact can be used to reduce data size as much as possible to avoid karma problems. A precise grammar of the "d" attribute is given below.</p>
  86. <p>A typical implementation will generate such paths by adding an 'M' command with the mouse coordinates on a mouse down event and adding an 'L' command with the mouse coordinates on every mouse move event as long as the mouse is down. It is up to the implementation to decide whether to complete and send the message on a mouse up event or to wait for a click on a send button.</p>
  87. </section2>
  88. <section2 topic='Whiteboard chat session'>
  89. <p>A more typical use case is where two clients share a whiteboard. Again the user will right click on the destination and will select a "whiteboard chat" option. The client will present a dialog where the user can create a drawing. Upon clicking a send button or releasing the mouse button, the client will send the following message:</p>
  90. <example caption='Initiating a whiteboard chat session'><![CDATA[
  91. <message
  92. from='kingclaudius@shakespeare.lit/castle'
  93. to='laertes@shakespeare.lit/castle'
  94. type='chat'>
  95. <thread>c357e044c676cc5e3c729d07544c87b58a366dba</thread>
  96. <body>... like the painting ... ?</body>
  97. <x xmlns='http://jabber.org/protocol/swb'>
  98. <path d='M100.0,100.0L300.0,100.0,200.0,300.0,100.0,100.0' id='kingclaudius1' />
  99. </x>
  100. </message>
  101. ]]></example>
  102. <p>In this case the dialog will not close. At the destination client a similar dialog will pop up, allowing the user at the other end to add her own part of the drawing. The resulting message will look like this (line breaks provided for readability only):</p>
  103. <example caption='Continuing a whiteboard chat session'><![CDATA[
  104. <message
  105. from='laertes@shakespeare.lit/castle'
  106. to='kingclaudius@shakespeare.lit/castle'
  107. type='chat'>
  108. <thread>c357e044c676cc5e3c729d07544c87b58a366dba</thread>
  109. <x xmlns='http://jabber.org/protocol/swb'>
  110. <path d='M 32 41 L 33 40 33 39 34 38 34 37 35 36 35 34 36 33 37
  111. 32 38 31 38 30 39 30 40 28 41 27 42 26 43 26 44 25 45
  112. 24 46 24 48 23 50 22 52 21 53 21 54 21 55 21 55 20 56
  113. 20 58 20 59 20 60 20 61 20 62 20 63 20 64 20 65 20 66
  114. 20 67 20 68 20 69 20 69 21 70 21 71 22 72 23 72 24 73
  115. 25 73 26 73 27 73 28 73 29 73 30 74 30 74 31 74 32 75
  116. 33 75 34 75 35 75 36 75 37 75 38 75 39 75 40 75 41 75
  117. 43 75 44 75 46 75 47 75 48 75 49 75 50 74 52 74 53 74
  118. 54 73 55 72 55 72 57 72 58 71 58 70 60 69 61 69 63 68
  119. 64 67 64 67 65 67 66 66 67 65 67 65 69 64 70 64 71 63
  120. 72 62 73 62 74 62 75 61 75 60 76 60 77 59 77 59 78 59
  121. 79 58 79 58 80 58 81 58 82 57 82 57 83 57 84 57 86 57
  122. 87 56 87 56 88 56 89 55 89 55 90 55 91 55 92 54 93 54
  123. 94 54 95 54 96 M 55 113 L 54 113 53 113 52 113 51 113
  124. 49 114 49 115 48 115 47 115 47 116 47 117 46 117 45 117
  125. 45 118 45 120 45 121 45 123 45 124 45 125 45 127 45 128
  126. 45 130 46 131 46 132 46 133 47 133 47 134 48 134 49 134
  127. 49 135 50 135 51 135 52 135 52 136 54 136 55 136 56 136
  128. 57 136 58 136 59 136 59 135 60 134 61 133 61 132 61 131
  129. 61 130 62 130 62 129 62 128 62 127 62 126 62 125 62 123
  130. 62 122 62 120 61 120 61 119 61 118 61 117 60 117 59 117
  131. 58 117 56 117 55 117 54 117' />
  132. </x>
  133. </message>
  134. ]]></example>
  135. <p>It is left as a mental exercise to the reader to imagine Laertes answer. Alternatively the reader could build this protocol into her favorite Jabber client, set a breakpoint, and paste the path above at the appropriate place.</p>
  136. <p>Alternatively Laertes could respond like:</p>
  137. <example caption='Moving a path'><![CDATA[
  138. <message
  139. from='laertes@shakespeare.lit/castle'
  140. to='kingclaudius@shakespeare.lit/castle'
  141. type='chat'>
  142. <thread>c357e044c676cc5e3c729d07544c87b58a366dba</thread>
  143. <x xmlns='http://jabber.org/protocol/swb'>
  144. <move id='kingclaudius1' dx='-100' dy='-100'/>
  145. </x>
  146. </message>
  147. ]]></example>
  148. <p>This would move the King's triangle 100 pixels to the left and top, to the upper left corner of the screen.</p>
  149. <p>If Laertes were bold enough he might even answer:</p>
  150. <example caption='Deleting a path'><![CDATA[
  151. <message
  152. from='laertes@shakespeare.lit/castle'
  153. to='kingclaudius@shakespeare.lit/castle'
  154. type='chat'>
  155. <thread>c357e044c676cc5e3c729d07544c87b58a366dba</thread>
  156. <x xmlns='http://jabber.org/protocol/swb'>
  157. <delete id='kingclaudius1'/>
  158. </x>
  159. </message>
  160. ]]></example>
  161. <p>This would remove King Claudius's triangle from the screen.</p>
  162. </section2>
  163. <section2 topic='Conference room whiteboard'>
  164. <p>The final use case is the one where multiple users, gathered in a conference room, share a single whiteboard. Messages will typically look like this:</p>
  165. <example caption='Conference room whiteboard'><![CDATA[
  166. <message
  167. from='nestor@shakespeare.lit'
  168. to='plains@conference.shakespeare.lit'
  169. type='groupchat'>
  170. <body>So, so, we draw together.</body>
  171. <x xmlns='http://jabber.org/protocol/swb'>
  172. <path d='M100,100l200,0L200,300,100,100' />
  173. </x>
  174. </message>
  175. ]]></example>
  176. </section2>
  177. </section1>
  178. <section1 topic='Implementation Notes'>
  179. <section2 topic='The GUI'>
  180. <p>Usually when a user wants to send a message to a contact, the client will present her with a choice between sending a message or starting a chat. If the client implements the present protocol, the client can add the options of sending a whiteboard message and starting a whiteboard chat. Whether the client offers these options for an individual contact could be based on standard &xep0030; or &xep0011; techniques.</p>
  181. <p>Presentation of a path in case of a "Single whiteboard message" is rather obvious. The presentation of multiple-user whiteboards, either chat or conference, leaves more to the imagination of the implementor. The implementor could decide to use different colors for paths drawn by different users. The saturation of a path could decrease with age.</p>
  182. </section2>
  183. <section2 topic='Karma'>
  184. <p>One issue that will hinder all whiteboard protocol implementations is the karma problem. At least jabberd uses karma to make sure that a client does not send to much data to the server. This should help against denial-of-service attacks. When you use up all your karma, the server stops handling your messages for a while. This is a problem for whiteboards because it is much easier to send a lot of drawing data, than to send a lot of textual data. Usually combining paths, that is, sending paths when the user clicks on a send button instead of on mouse up, reduces data size because it reduces the overhead of the message element. Using the relative lineto command ('l') instead of the absolute lineto ('L') command will also reduce message size, because usually relative coordinates will only use one or two digits whereas absolute coordinates will typically use three. Finally implementations can reduce message size by not recording every mouse move event, e.g. by dropping mouse events whose locations would be accurately interpolated.</p>
  185. </section2>
  186. <section2 topic='Text'>
  187. <p>The protocol does not provide explicit support for drawing text. The reason for this is that explicit support, eg. in the form of the SVG text element <note>Text - SVG 1.0 <link url="http://www.w3.org/TR/SVG/text.html">http://www.w3.org/TR/SVG/text.html</link></note>, would break the second and third requirements above. However a client can still provide text support by representing characters as paths, eg. by using a Hershey font.</p>
  188. <p>The code snippet below shows the lines along which this could be done:</p>
  189. <example caption='Coding the letter A into a path'><![CDATA[
  190. // generating the path <path d='M14 6l-8,21M14 6l8,21M9 20l10,0'/> from the letter 'A'
  191. static char* sHersheyFontData[] = {
  192. ...
  193. "I[RFJ[ RRFZ[ RMTWT", // the character A, consisting of three strokes
  194. ...
  195. };
  196. for (int i = 0 ; sHersheyFontData ['A'][2*i+2] != 0 ; i++) {
  197. // read a new coordinate pair
  198. POINT myPoint = {sHersheyFontData ['A'][2*i+2]-'R', sHersheyFontData ['A'][2*i+2+1]-'R')};
  199. // test for the special case pen up
  200. if (myPoint.x == -50 && myPoint.y == 0) {
  201. penUp = true;
  202. } else {
  203. if (penUp) {
  204. penUp = false;
  205. currentPathSet.push_back (std::vector <POINT> ()); // pen goes down, add a new path
  206. }
  207. currentPathSet.back ().push_back (myPoint); // pen is down add a new point to the latest path
  208. }
  209. }
  210. ]]></example>
  211. <p>The string 'Jabber' would be encoded as the path 'M24 59l0,16-1,3-1,1-2,1-2,0-2-1-1-1-1-3 0-2M43 66l0,14M43 69l-2-2-2-1-3,0-2,1-2,2-1,3 0,2 1,3 2,2 2,1 3,0 2-1 2-2M51 59l0,21M51 69l2-2 2-1 3,0 2,1 2,2 1,3 0,2-1,3-2,2-2,1-3,0-2-1-2-2M70 59l0,21M70 69l2-2 2-1 3,0 2,1 2,2 1,3 0,2-1,3-2,2-2,1-3,0-2-1-2-2M88 72l12,0 0-2-1-2-1-1-2-1-3,0-2,1-2,2-1,3 0,2 1,3 2,2 2,1 3,0 2-1 2-2M107 66l0,14M107 72l1-3 2-2 2-1 3,0', which is 357 characters long. That is no more than twice the size of a typical groupchat text message. </p>
  212. </section2>
  213. <section2 topic='Clearing the screen'>
  214. <p>Some of the protocols mentioned in the introduction, have a clear-screen command. However the benefits of such a command are doubtful. Of course clients can implement such a command locally. A client might even implement finer control such as the possibility of opening new windows that will receive new paths, or showing paths based on whether they were drawn in a selectable timespan. Synchronization of such complex actions between clients is clearly beyond the scope of this protocol. Of course when it is absolutely necessary to clear the screens of both sides in a whiteboard chat, that could be implemented by sending delete-commands for all paths.</p>
  215. </section2>
  216. </section1>
  217. <section1 topic='Security Considerations'>
  218. <p>There are no security features or concerns related to this proposal.</p>
  219. </section1>
  220. <section1 topic='IANA Considerations'>
  221. <p>This document requires no interaction with the &IANA;.</p>
  222. </section1>
  223. <section1 topic='XMPP Registrar Considerations'>
  224. <p>This document requires registration of the namespace "http://jabber.org/protocol/swb" by the &REGISTRAR;.</p>
  225. </section1>
  226. <section1 topic='Formal Definition'>
  227. <section2 topic='Schema'>
  228. <code><![CDATA[
  229. <?xml version='1.0' encoding='UTF-8'?>
  230. <xs:schema
  231. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  232. targetNamespace='http://jabber.org/protocol/swb'
  233. xmlns='http://jabber.org/protocol/swb'
  234. elementFormDefault='qualified'>
  235. <xs:element name='x'>
  236. <xs:complexType>
  237. <xs:element ref='path' minOccurs='0' maxOccurs='unbounded'/>
  238. <xs:element ref='move' minOccurs='0' maxOccurs='unbounded'/>
  239. <xs:element ref='delete' minOccurs='0' maxOccurs='unbounded'/>
  240. </xs:complexType>
  241. </xs:element>
  242. <xs:element name='path'>
  243. <xs:complexType>
  244. <xs:attribute name='d' type='xs:string' use='required'/>
  245. <xs:attribute name='stroke' type='xs:string' use='optional' default='#000000'/>
  246. <xs:attribute name='stroke-width' type='xs:integer' use='optional' default='1'/>
  247. <xs:attribute name='id' type='xs:string' use='optional'/>
  248. </xs:complexType>
  249. </xs:element>
  250. <xs:element name='move'>
  251. <xs:complexType>
  252. <xs:attribute name='id' type='xs:string' use='required'/>
  253. <xs:attribute name='dx' type='xs:integer' use='required'/>
  254. <xs:attribute name='dy' type='xs:integer' use='required'/>
  255. </xs:complexType>
  256. </xs:element>
  257. <xs:element name='delete'>
  258. <xs:complexType>
  259. <xs:attribute name='id' type='xs:string' use='required'/>
  260. </xs:complexType>
  261. </xs:element>
  262. </xs:schema>
  263. ]]></code>
  264. </section2>
  265. <section2 topic='DTD'>
  266. <code><![CDATA[
  267. <?xml version='1.0' encoding='UTF-8'?>
  268. <!ELEMENT x (path*, move*, delete*) >
  269. <!ELEMENT path EMPTY >
  270. <!ATTLIST path d CDATA #REQUIRED
  271. stroke CDATA #IMPLIED
  272. stroke-width CDATA #IMPLIED
  273. id CDATA #IMPLIED >
  274. <!ELEMENT move EMPTY >
  275. <!ATTLIST move id CDATA #REQUIRED
  276. dx CDATA #REQUIRED
  277. dy CDATA #REQUIRED >
  278. <!ELEMENT delete EMPTY >
  279. <!ATTLIST delete id CDATA #REQUIRED >
  280. ]]></code>
  281. </section2>
  282. <section2 topic='Grammar of "d" attribute'>
  283. <p>The grammar of the "d" attribute below is a slight simplification of section 8.3.9 in <note>Scalable Vector Graphics (SVG) 1.0 Specification, section 8.3.1.: The grammar for path data <link url="http://www.w3.org/TR/SVG/paths.html#PathDataBNF">http://www.w3.org/TR/SVG/paths.html#PathDataBNF</link></note>.</p>
  284. <code><![CDATA[
  285. simple-whiteboard-path:
  286. wsp* moveto-drawto-command-groups? wsp*
  287. moveto-drawto-command-groups:
  288. moveto-drawto-command-group
  289. | moveto-drawto-command-group wsp* moveto-drawto-command-groups
  290. moveto-drawto-command-group:
  291. moveto wsp* drawto-commands?
  292. drawto-commands:
  293. drawto-command
  294. | drawto-command wsp* drawto-commands
  295. drawto-command:
  296. lineto
  297. moveto:
  298. ( "M" | "m" ) wsp* moveto-argument-sequence
  299. moveto-argument-sequence:
  300. coordinate-pair
  301. | coordinate-pair comma-wsp? lineto-argument-sequence
  302. lineto:
  303. ( "L" | "l" ) wsp* lineto-argument-sequence
  304. lineto-argument-sequence:
  305. coordinate-pair
  306. | coordinate-pair comma-wsp? lineto-argument-sequence
  307. coordinate-pair:
  308. coordinate comma-wsp? coordinate
  309. coordinate:
  310. number
  311. nonnegative-number:
  312. integer-constant
  313. | floating-point-constant
  314. number:
  315. sign? integer-constant
  316. | sign? floating-point-constant
  317. flag:
  318. "0" | "1"
  319. comma-wsp:
  320. (wsp+ comma? wsp*) | (comma wsp*)
  321. comma:
  322. ","
  323. integer-constant:
  324. digit-sequence
  325. floating-point-constant:
  326. fractional-constant exponent?
  327. | digit-sequence exponent
  328. fractional-constant:
  329. digit-sequence? "." digit-sequence
  330. | digit-sequence "."
  331. exponent:
  332. ( "e" | "E" ) sign? digit-sequence
  333. sign:
  334. "+" | "-"
  335. digit-sequence:
  336. digit
  337. | digit digit-sequence
  338. digit:
  339. "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
  340. wsp:
  341. (#x20 | #x9 | #xD | #xA)
  342. ]]></code>
  343. </section2>
  344. </section1>
  345. <section1 topic='Conclusion'>
  346. <p>The present protocol satisfies its basic requirements: it allows for freehand drawing, it is easy to implement, light-weight and it requires no server changes.</p>
  347. </section1>
  348. <section1 topic='Acknowledgements'>
  349. <p>The author would like to thank Alexey Shchepin for helpful comments.</p>
  350. </section1>
  351. </xep>