WebSocket Demos
Download ws.zip for all code that we
developed in class. Unzip it in your web space, replace the port
numbers to be your assigned port number, then it should work without
needing to install anything.
- Simple echo server: echoServerSimple.js
- Simple boardcast server: echoServerBroadcast.js
- Simple chat client: echoClient.html. With the echo
server, this is a chat application where the user talks to
themselves. With the broadcast server, this is a real chat
application. We tried inserting a YouTube video to show that
WebSocket works better than the polling way that did
before.
- The canvas drawing client using the same broadcast server: draw.html. We started with a version
where everyone draw in the same colour, then we modified it to that
each client has its own colour. The catch was that the colour info
need to be included in the message sent to the server.