forked from socketio/socket.io
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bumped node version Updated client Make sure constructors are called Added tests
- Loading branch information
Showing
10 changed files
with
81 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule client
updated
from 09094a to c42d18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
var Listener = require('./lib/socket.io/listener'); | ||
|
||
this.listen = function(server, options){ | ||
return new Listener(server, options); | ||
exports.Listener = require('./lib/socket.io/listener'); | ||
exports.listen = function(server, options){ | ||
return new exports.Listener(server, options); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
var io = require('./../'), | ||
Listener = io.Listener, | ||
Client = require('./../lib/socket.io/client'), | ||
WebSocket = require('./support/node-websocket-client/lib/websocket').WebSocket, | ||
empty = new Function, | ||
port = 8080, | ||
|
||
create = function(fn){ | ||
var server = require('http').createServer(empty), client; | ||
server.listen(port, function(){ | ||
client = new WebSocket('ws://localhost:'+ port++ +'/socket.io/websocket', 'borf'); | ||
}); | ||
return {server: server, client: client, close: function(){ | ||
client.close(); | ||
server.close(); | ||
}}; | ||
}; | ||
|
||
module.exports = { | ||
'test server initialization': function(assert){ | ||
var http = create(), | ||
sio = io.listen(http.server); | ||
assert.ok(sio instanceof Listener); | ||
http.close(); | ||
}, | ||
|
||
'test connection and handshake': function(assert){ | ||
var server = require('http').createServer(empty), | ||
sio = io.listen(server), | ||
client, | ||
clientCount = 0, | ||
|
||
close = function(){ | ||
client.close(); | ||
server.close(); | ||
assert.ok(clientCount, 1); | ||
}; | ||
|
||
server.listen(port, function(){ | ||
client = new WebSocket('ws://localhost:'+ port++ +'/socket.io/websocket', 'borf'); | ||
client.onmessage = function(){ | ||
console.log('test'); | ||
}; | ||
}); | ||
|
||
sio.on('connection', function(client){ | ||
console.log('test'); | ||
clientCount++; | ||
assert.ok(client instanceof Client); | ||
}); | ||
} | ||
}; |