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!
-
http://github.com/katspaugh/whiteboard – katspaugh Feb 06 '13 at 11:46
2 Answers
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:
-
Pusher sounds really good. But, I'm just a beginner & doing this project in university. Could you please elaborate/explain/give me any ideas or resources as to how I can use pusher to fulfill my purpose. And as to whether there could be any limitations? Thanks! – P.C. Jan 12 '12 at 17:38
-
@PrernaChikersal I don't want to turn this into a Pusher specific question but the [quickstart guide](http://pusher.com/docs/quickstart) and [tutorials](http://pusher.com/tutorials) is a good starting point. If you've Pusher-related questions you should probably go through [Pusher Support](http://pusher.com/support). You can find a [getting started with WebSockets resource](http://stackoverflow.com/questions/2988133/getting-started-with-web-sockets) here on StackOverflow as a general good starting point. – leggetter Jan 12 '12 at 20:25
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.

- 334,560
- 70
- 407
- 495
-
Our website is hosted on host4post.com. I don't know anything about node.js. Can you please elaborate? Thanks a lot! – P.C. Jan 10 '12 at 21:02
-
webhosts operate server software such as "apache" as a managed service. "node.js" (or any other software that can act as a WebSocket server) is not typically offered like that. – Alnitak Jan 10 '12 at 21:04
-
Thanks. Lets say if I don't use websockets. Is there some other way to implement the same application? – P.C. Jan 10 '12 at 21:05