Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Websocket library for browsers?

Are there websocket libraries (like ajax for jquery) I can use on the browsers with fallback to ajax long polling?

like image 805
ajsie Avatar asked Apr 01 '11 07:04

ajsie


2 Answers

I found that Socket.IO implements a weird, arbitrary layer over the WebSocket protocol. I'd rather just pass raw data back and forth, so for my project, I went with web-socket-js.

web-socket-js works similarly to Socket.IO in that it reverts to using Flash sockets if WebSocket support is unavailable. Thus, it works in all the major browsers that support Flash (I tested this myself).

Just make sure you open port 843 in your firewall or you'll get a Flash security policy error. You'll probably need a script to listen on port 843 as well...I used em-websocket for the socket server, and in its readme I believe is a link to a Perl script that provides this.

like image 159
Chad Johnson Avatar answered Oct 12 '22 00:10

Chad Johnson


Library with WebSockets support and fallback long polling solution would probably depend also on server side technology and not only browser client. Try to look at socket.io for example.

like image 22
yojimbo87 Avatar answered Oct 12 '22 01:10

yojimbo87