Skip to content

API Reference

This gives details on the new top level objects for


express = require('')


  • express() - Creates a new app object.
  • - The object.


app = require('')()


  • app.http() - starts an http server, returns app
  • app.https(options) - starts an https server, returns app
  • - starts an io server, returns app

For a complete list of properties, please check the docs.


The io object for the entire app. Used for routing and broadcasting to clients.'hey', {this: 'goes to everyone!'})'hipster').broadcast('meh', {this: 'goes to all hipsters'})'special', function(req) {
    // do something with req

You can also use the AppIO object to configure your io server. For available options, check here. {'browser client minification');  // send minified client'browser client gzip');          // gzip the file'log level', 1);                    // reduce logging

Note: You must call before using.


  •, data) - Broadcast the event and data to all clients.
  •, data) - Broadcast the event and data only to clients in the room.
  •, callback) - Takes a route name and a callback. The callback passes req, which is a SocketRequest object.
  •, value) - Set a global io server property.
  • - Enable an io server feature.
  • - Similar to the app.configure method for express.


This object is passed to the io routes.'hello', function(req) {
    // do something with req


  • - The data sent from the client request.
  • - The RequestIO object for the request.
  • req.headers - headers from the initial web socket request.
  • req.session - If you have sessions, then this is the express session object.
  • req.handshake - This is the io handshake data.
  • req.socket - The actual socket. Please use instead.


This object comes with the SocketRequest, and it gives you access to the request io.'example', function(req) {'event', {this: 'is sent as an event to the client'})'shout-out', {this: 'goes to every client, except this one'}){sends: 'this data back to the client as an acknowledgment'})'hipster') // joins the hipster room'hipster') // leaves the hipster room'hipster').broadcast('hey', {this: 'goes to every hipster'})'some-other-route')



  •, data) - Send an event with data to this client.
  • - Sends the acknowledgment data back to the client.
  •, data) - Broadcast to all clients except this one.
  •,data) - Broadcast to the specified room, the event and data. Every client in the room except the one making the request, receives this event.
  • - Make the client join the specified room.
  • - Make the client leave the specified room.
  • - Forwards the req to the given route.

Reserved Events

These events are reserved and should not be used with or unless you know what you are doing.

  • connect
  • connecting
  • disconnect
  • connect_failed
  • error
  • message
  • reconnect_failed
  • reconnect
  • reconnecting

View the docs for details on these events.

Something went wrong with that request. Please try again.