diff --git a/test/socket.io.js b/test/socket.io.js index 6f4c87b367..230234cc6c 100644 --- a/test/socket.io.js +++ b/test/socket.io.js @@ -6,10 +6,15 @@ var request = require('supertest'); var expect = require('expect.js'); // creates a socket.io client for the given server -function client(srv, nsp){ +function client(srv, nsp, opts){ + if ('object' == typeof nsp) { + opts = nsp; + nsp = null; + } var addr = srv.address(); if (!addr) addr = srv.listen().address(); - return ioc('ws://' + addr.address + ':' + addr.port + (nsp || '')); + var url = 'ws://' + addr.address + ':' + addr.port + (nsp || ''); + return ioc(url, opts); } describe('socket.io', function(){