Send custom data along with handshakeData in socket.io?

As a lot of comments have pointed out below the Socket.IO API changed in their 1.0 release. Authentication should now be done via a middleware function, see ‘Authentication differences’ @ http://socket.io/docs/migrating-from-0-9/#authentication-differences. I’ll include my orginal answer for anyone stuck on <1.0 as the old docs seem to be gone. 1.0 and later: Client Side: //The … Read more

How to protect against distributed denial-of-service attacks in Node.js with Socket.io?

Look into JS event throttling and debouncing! Those techniques will help you prevent and detect attacks to a certain point (which is, in my opinion, enough for a small multiplayer socket game)… EDIT: In this jsfiddle: http://jsfiddle.net/y4tq9/9/ var sIO = {}; sIO.on = (function(){ var messages = {}; var speedLimit = 5; //5ms return function(message, … Read more

List of Socket.io Events

Here is all I found in the official docs: Client-side events for socket.io object: connect. Fired upon a successful connection. connect_error. Fired upon a connection error.Parameters: Object error object connect_timeout. Fired upon a connection timeout. reconnect. Fired upon a successful reconnection.Parameters: Number reconnection attempt number reconnect_attempt. Fired upon an attempt to reconnect. reconnecting. Fired upon … Read more

What’s the difference between engine.io and socket.io?

engine.io is a lower level library than socket.io. Engine is to Socket.IO what Connect is to Express. If you want the lower level abstraction, use engine.io. If you want a websocket abstraction, keep using socket.io. engine.io is of more interest to you if you’re building a library/framework on top of socket.io. socket.io is of more … Read more

Node.js, Socket.io, Redis pub/sub high volume, low latency difficulties

I thought this was a reasonable question and had researched it briefly a while back. I spent a little time searching for examples that you may be able to pick up some helpful tips from. Examples I like to begin with straight forward examples: light im sample code Node.js + Redis Pub/Sub + socket.io demo … Read more