diff --git a/.travis.yml b/.travis.yml index 895dbd3..0fe6735 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ language: node_js +sudo: false node_js: - - 0.6 - - 0.8 + - node diff --git a/History.md b/History.md index d59b941..e66f802 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,10 @@ +0.2.2 / 2017-01-02 +================== + + * Updated EventEmitter to work with node v7 + * Allow mocha tests to run on ipv6 machines + 0.2.1 / 2012-07-03 ================== diff --git a/lib/protocols/drafts.js b/lib/protocols/drafts.js index bb5db72..f83ee98 100644 --- a/lib/protocols/drafts.js +++ b/lib/protocols/drafts.js @@ -10,7 +10,7 @@ */ var Socket = require('../socket') - , EventEmitter = process.EventEmitter + , EventEmitter = require('events') , crypto = require('crypto') , debug = require('debug')('wsio:drafts') diff --git a/lib/server.js b/lib/server.js index 9f11c4e..82e27fb 100644 --- a/lib/server.js +++ b/lib/server.js @@ -4,7 +4,7 @@ */ var protocols = require('./protocols') - , EventEmitter = process.EventEmitter + , EventEmitter = require('events') , url = require('url'); /** diff --git a/lib/socket.js b/lib/socket.js index 98777cd..e2683af 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -3,7 +3,7 @@ * Module dependencies. */ -var EventEmitter = process.EventEmitter +var EventEmitter = require('events'); /** * Module exports. diff --git a/lib/websocket.io.js b/lib/websocket.io.js index 739671f..de3dfb0 100644 --- a/lib/websocket.io.js +++ b/lib/websocket.io.js @@ -12,7 +12,7 @@ var net = require('net') * @api public */ -exports.version = '0.2.1'; +exports.version = '0.2.2'; /** * WebSocket protocols impls. @@ -59,7 +59,7 @@ exports.listen = function (port, fn, options) { res.end('Not Implemented'); }); - server.listen(port, fn); + server.listen(port || 0, fn); // create ws server var ws = exports.attach(server, options); diff --git a/package.json b/package.json index d978527..9e004b1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "websocket.io" , "description": "Socket.IO websocket server" - , "version": "0.2.1" + , "version": "0.2.2" , "contributors": [ { "name": "Guillermo Rauch", "email": "rauchg@gmail.com" } , { "name": "Einar Otto Stangvik", "email": "einaros@gmail.com" } diff --git a/support/server-common.js b/support/server-common.js index b3bf97d..4b8f7c6 100644 --- a/support/server-common.js +++ b/support/server-common.js @@ -45,7 +45,12 @@ listen = function (options, fn) { */ client = function (addr, path) { - var cl = new Client('ws://' + addr.address + ':' + addr.port + (path || '')); + var address = addr.address; + if (addr.family == 'IPv6') { + address = '[' + address + ']'; + } + + var cl = new Client('ws://' + address + ':' + addr.port + (path || '')); cl.on('error', function (e) { throw e; }); diff --git a/test/websocket.io.js b/test/websocket.io.js index 5736c88..785b7b8 100644 --- a/test/websocket.io.js +++ b/test/websocket.io.js @@ -3,6 +3,7 @@ * Test dependencies. */ +var should = require('should'); var ws = require('../lib/websocket.io') , http = require('http') @@ -17,12 +18,12 @@ describe('websocket.io', function () { }); it('must expose public constructors', function () { - ws.Socket.should.be.a('function'); - ws.Server.should.be.a('function'); - ws.protocols.drafts.should.be.a('function'); - ws.protocols['7'].should.be.a('function'); - ws.protocols['8'].should.be.a('function'); - ws.protocols['13'].should.be.a('function'); + ws.Socket.should.be.a.Function; + ws.Server.should.be.a.Function; + ws.protocols.drafts.should.be.a.Function; + ws.protocols['7'].should.be.a.Function; + ws.protocols['8'].should.be.a.Function; + ws.protocols['13'].should.be.a.Function; }); it('must connect', function (done) {