Socket#emit

Socket#emit(name:String[, …]):Socket Emits an event to the socket identified by the string name. Any other parameters can be included. All datastructures are supported, including Buffer. JavaScript functions can’t be serialized/deserialized. var io = require('socket.io')(); io.on('connection', function(socket){ socket.emit('an event', { some: 'data' }); });

Socket#rooms

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

Client

Client The Client class represents an incoming transport (engine.io) connection. A Client can be associated with many multiplexed Socket that belong to different Namespaces.

Server#bind

Server#bind(srv:engine#Server):Server Advanced use only. Binds the server to a specific engine.io Server (or compatible API) instance.

Socket#leave

Socket#leave(name:String[, fn:Function]):Socket Removes the socket from room, and fires optionally a callback fn with err signature (if any). Rooms are left automatically upon disconnection. The mechanics of leaving rooms are handled by the Adapter that has been configured (see Server#adapter above), defaulting to socket.io-adapter.

Server#adapter

Server#adapter(v:Adapter):Server Sets the adapter v. Defaults to an instance of the Adapter that ships with socket.io which is memory based. See socket.io-adapter. If no arguments are supplied this method returns the current value.

Client#conn

Client#conn A reference to the underlying engine.io Socket connection.

Server#serveClient

Server#serveClient(v:Boolean):Server If v is true the attached server (see Server#attach) will serve the client files. Defaults to true. This method has no effect after attach is called. // pass a server and the `serveClient` option var io = require('socket.io')(http, { serveClient: false }); // or pass no server and then you can call the method var io = require('socket.io')(); io.serveClient(false); io.attach(http); If no arguments are supplied this method returns the current value.

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' }); });

IO

IO(url:String, opts:Object):Socket Exposed as the io global in window if using the standalone build (eg: /socket.io/socket.io.js or the CDN), or the result of calling require('socket.io-client'). When called, it creates a new Manager for the given URL, and attempts to reuse an existing Manager for subsequent calls, unless the multiplex option is passed with false. Passing this option is the equivalent of passing 'force new connection': true. The rest of the options are passed to the Manager con