The last time Hackerfall tried to access this page, it returned a not found error. A cached version of the page is below, or clickhereto continue anyway

Socket.IO Socket.IO 1.1.0

Today we pushed version 1.1.0 of Socket.IO with a lots of bug fixes and some new additions. This release comes thanks to the work of more than 20 contributors.

Server

Client

Here are some examples of what you can do with the new features:

It is now possible to cleanly close the socket.io server like so:

var app = require('http').createServer();
var io = require('socket.io')(app);
var fs = require('fs');

app.listen(3333, function() {
  io.close();
});

Namespaces can be declared without the / prefix:

var app = require('http').createServer();
var io = require('socket.io')(app);

// '' and '/' are equal
io.of('').on('connection', function(){
  // Connecting to '/' will do the trick
});
// 'abc' and '/abc' are equal
io.of('abc').on('connection', function(){
  // Connecting to '/abc' will do the trick
});

There’s now an auto connect option in socket.io-client, making it possible to disable connecting without explicitly calling manager.open.

var manager = io.Manager('http://localhost:9823', { autoConnect: false });
setTimeout(function(){
  manager.open(); // Won't start connecting until now
}, 500);

Our tests are faster and better than ever using the travis build matrix!

You can find the example build here!

The remoteAddress property on the connection is now cached so it should always be accessible. It can be accessed either in the handshake object, or directly from engine.io:

io.on('connection', function(socket){
  console.log(socket.handshake.address);
  console.log(socket.client.conn.remoteAddress);
});

It is now possible to disable JSONP as a transport. If disabled (by settings to false) an error will be emitted (saying “No transports available”) if no other transports can form a connection. If another transport is available for opening a connection (e.g. WebSocket) that transport will be used instead.

var socket = require('engine.io-client')('ws://localhost', { jsonp: false });
socket.on('open', function(){
  socket.on('message', function(data){});
  socket.on('close', function(){});
});

You can now use XDomainRequest to avoid loading bar flashing in IE8:

var socket = require('engine.io-client')('ws://localhost', { enablesXDR: true });
socket.on('open', function(){
  socket.on('message', function(data){});
  socket.on('close', function(){});
});

The option defaults to false because XDomainRequest has a known flaw of not sending cookies.

Socket.IO-client 1.1.0 can be found in the Socket.IO CDN:

<script src="https://cdn.socket.io/socket.io-1.1.0.js"></script>

A big thank you to everyone who participated in the making of the release by reporting issues, getting involved in discussion, and/or contributing code. Keep being awesome, and stay tuned for more updates!

Continue reading on socket.io