Creating an online whiteboard app using websockets & HTML5?

4.1k views Asked by At

I plan to use HTML5, php, websockets, jQuery & MySql as backend (if saving, etc is required). However, I have no prior experience in websockets. This is an example I found: http://www.codeproject.com/KB/aspnet/WebSocketWhiteBoard.aspx However they are taking websockets from localserver. I wish to use the websocket API provided. http://dev.w3.org/html5/websockets/ We need to begin with a handshake between the client & server. Can you help me as to how I can do so? Thanks!

2

There are 2 answers

2
leggetter On

You could look at PHP WebSocket, apache-websocket/mod_websocket, you could use a separate self hosted realtime web solution or look at a hosted realtime service such as Pusher (who I work for).

There are a number of similar questions about using WebSockets, PHP and related technologies which I recommend you take a look at:

3
Alnitak On

Unless you're using something like node.js as your web server (and as you're planning to use PHP I presume that's not the case) you actually need a separate WebSocket server too.

If you're running on your own hardware that should be fine, but you're unlikely to find a standard ISP web-host offering you the ability to run your own servers daemons.

There are a number of WebSocket servers and/or libraries available that perform the WebSocket protocol handshake. I've used one that was written for node.js but unfortunately the WS specification was still going through some changes and it's no longer compatible with Chrome.

Also, don't get confused by Socket.IO which many people refer to as "WebSockets" - it's not - it's a more general communications method that looks a bit like WebSockets, and may use real WebSockets as its transport layer, but is actually a different protocol altogether.