Skip to content Skip to sidebar Skip to footer

What Is The Best Practice For Websocket Server(s)?

Lets say you have a site where users may open chat rooms. Once a room is opened, the users may invite others and chat. Lets also pretend you want to use WebSockets for the communic

Solution 1:

Just roll your own version of the broadcast for each room you keep a list of users in that room, and if someone sends a message in/to that room just send it to all the users in the room, depending on your protocol you can then exclude the original sender of the message.

You have a list of users for each room anyway, so you can just add the connection as a property to the user object.

But keep in mind that due to recently "discovered" security problem with the current WebSocket specification, both Opera and Mozilla have disabled support for WebSocket until a new version has been issued. So it will take some more time for WebSockets to have widespread availability and server needs to change to with the new version.

For details see: http://hacks.mozilla.org/2010/12/websockets-disabled-in-firefox-4/http://blog.pusherapp.com/2010/12/9/it-s-not-websockets-it-s-your-broken-proxy

Post a Comment for "What Is The Best Practice For Websocket Server(s)?"