Socket

Socket Events connect. Fired upon connecting. error. Fired upon a connection error Parameters: Object error data disconnect. Fired upon a disconnection. reconnect. Fired upon a successful reconnection. Parameters: Number reconnection attempt number reconnect_attempt. Fired upon an attempt to reconnect. reconnecting. Fired upon an attempt to reconnect. Parameters: Number reconnection attempt number reconnect_error. Fired upon a reconnection attempt error. Parameters: Object error o

Manager#reconnection

Manager#reconnection(v:Boolean):Manager Sets the reconnection option, or returns it if no parameters are passed.

Server#path

Server#path(v:String):Server Sets the path v under which engine.io and the static files will be served. Defaults to /socket.io. If no arguments are supplied this method returns the current value.

Socket#rooms

Socket#rooms:Array A list of strings identifying the rooms this socket is in.

Socket#to

Socket#to(room:String):Socket

Socket#join

Socket#join(name:String[, fn:Function]):Socket Adds the socket to the room, and fires optionally a callback fn with err signature (if any). The socket is automatically a member of a room identified with its session id (see Socket#id). The mechanics of joining rooms are handled by the Adapter that has been configured (see Server#adapter above), defaulting to socket.io-adapter.

Server#origins

Server#origins(v:String):Server Sets the allowed origins v. Defaults to any origins being allowed. If no arguments are supplied this method returns the current value.

Server#emit

Server#emit Emits an event to all connected clients. The following two are equivalent: var io = require('socket.io')(); io.sockets.emit('an event sent to all connected clients'); io.emit('an event sent to all connected clients'); For other available methods, see Namespace below.

Socket#in

Socket#in(room:String):Socket Sets a modifier for a subsequent event emission that the event will only be broadcasted to sockets that have joined the given room. To emit to multiple rooms, you can call to several times. var io = require('socket.io')(); io.on('connection', function(socket){ socket.to('others').emit('an event', { some: 'data' }); });

Socket

Socket A Socket is the fundamental class for interacting with browser clients. A Socket belongs to a certain Namespace (by default /) and uses an underlying Client to communicate.