tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 55639] New: Add Drawboard Websocket Example
Date Mon, 07 Oct 2013 23:16:40 GMT

            Bug ID: 55639
           Summary: Add Drawboard Websocket Example
           Product: Tomcat 8
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Examples

Created attachment 30909
Patch to add the Drawboard example


I would like to add this Drawboard example to Tomcat's Websocket examples.

It is a page where you can draw with your mouse or touch input (using different
colors) and everybody else which has the page open will immediately see what
you are drawing.
If someone opens the page later, they will get the current room image (so they
can see what was already drawn by other people).

It uses asynchronous sending of messages so that it doesn't need separate
threads for each client to send messages (this needs NIO or APR connector to be
A "Room" (where the drawing happens) has a dedicated thread because the actions
which are done in one Room are single-threaded (like drawing to a
BufferedImage). If multiple rooms were used, then each Room would have its own
dedicated thread (but currently only one Room is implemented).

When you open the page, first you will receive a binary websocket message
containing the current room image as PNG image. After that, you will receive
string messages that contain the drawing actions (line from x1,y1 to x2,y2).
Note that it currently only uses simple string messages instead of JSON because
I did not want to introduce a dependency on a JSON lib.

It uses synchronization mechanisms to ensure that the final image will look the
same for every user, regardless of what their network latency/speed is - e.g.
if two user draw at the same time on the same place, the server will decide
which line was the first one, and that will be reflected on every client.

What do you think?

You are receiving this mail because:
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message