Skip to content
jtlebi edited this page Mar 4, 2012 · 13 revisions

Struggling to find this documentation, so adding here what I know...

Unknown

The following are rumored to exist, but need documentation. If you know, please add to either the client or server section below.

  • 'reconnect_failed' event.
  • 'reconnect' event.

Server

On the server, assuming var io = require('socket.io'),

  • io.sockets.on('connection'), function(socket) {}) - initial connection from a client. socket argument should be used in further communication with the client.
  • socket.on('anything'), function(data) {}) - "anything" can be any event except for the reserved ones.
  • socket.on('disconnect', function() {}) - fired when the socket disconnects? Not sure when exactly, i.e. will it only fire if client initiates disconnect or also if server initiates disconnect. Does it fire on unexpected network failure, or a mobile device losing connection?

Client

The client doc (including event list) is available here: https://github.com/LearnBoost/socket.io-client

On the client, assuming var socket = io.connect(host, options),

  • socket.on('anything', function(data, callback) {}) - "anything" can be any event except for the reserved ones. data is data, and callback can be used to send a reply.

Clone this wiki locally