forked from socketio/socket.io
-
Notifications
You must be signed in to change notification settings - Fork 1
Exposed events
DukeyToo edited this page Jan 18, 2012
·
13 revisions
Struggling to find this documentation, so adding here what I know...
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.
On the server, assuming var io = require('socket.io'),
-
io.sockets.on('connection'), function(socket) {})- initial connection from a client.socketargument 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?
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.