Skip to content

Instantly share code, notes, and snippets.

@pokoli
Created October 30, 2011 12:32
Show Gist options
  • Save pokoli/1325853 to your computer and use it in GitHub Desktop.
Save pokoli/1325853 to your computer and use it in GitHub Desktop.
Socket.io test
var port = 8080,
io = require('socket.io').listen(port);
module.exports = {
"Test socket.io" : function(beforeExit){
var client = require('socket.io-client').connect( "http://localhost", { port: port });
client.on('connect', function() {
console.log('connect')
client.disconnect();
});
client.on('disconnect', function() {
console.log(' client disconnect');
client.socket.transport.websocket.finishClose();
io.server.close();
beforeExit();
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment