Server#use

Server#use See Namespace#use below.

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.

Socket#id

Socket#id:String A unique identifier for the socket session, that comes from the underlying Client.

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

Server#of

Server#of(nsp:String):Namespace Initializes and retrieves the given Namespace by its pathname identifier nsp. If the namespace was already initialized it returns it right away.

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.

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.

Server#onconnection

Server#onconnection(socket:engine#Socket):Server Advanced use only. Creates a new socket.io client from the incoming engine.io (or compatible API) socket.

Server#sockets

Server#sockets:Namespace The default (/) namespace.

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.