Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated process.EventEmitter #57

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
language: node_js
sudo: false
node_js:
- 0.6
- 0.8
- node
6 changes: 6 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -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
==================

Expand Down
2 changes: 1 addition & 1 deletion lib/protocols/drafts.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

var Socket = require('../socket')
, EventEmitter = process.EventEmitter
, EventEmitter = require('events')
, crypto = require('crypto')
, debug = require('debug')('wsio:drafts')

Expand Down
2 changes: 1 addition & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

var protocols = require('./protocols')
, EventEmitter = process.EventEmitter
, EventEmitter = require('events')
, url = require('url');

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Module dependencies.
*/

var EventEmitter = process.EventEmitter
var EventEmitter = require('events');

/**
* Module exports.
Expand Down
4 changes: 2 additions & 2 deletions lib/websocket.io.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var net = require('net')
* @api public
*/

exports.version = '0.2.1';
exports.version = '0.2.2';

/**
* WebSocket protocols impls.
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]" }
, { "name": "Einar Otto Stangvik", "email": "[email protected]" }
Expand Down
7 changes: 6 additions & 1 deletion support/server-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
13 changes: 7 additions & 6 deletions test/websocket.io.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Test dependencies.
*/

var should = require('should');
var ws = require('../lib/websocket.io')
, http = require('http')

Expand All @@ -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) {
Expand Down