mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-14 03:54:14 +00:00
Set up new module structure
This commit is contained in:
parent
5f5178d2e8
commit
2e864f5293
534 changed files with 235854 additions and 1 deletions
26
node_modules/socket.io/support/node-websocket-client/test/test-ready-state.js
generated
vendored
Normal file
26
node_modules/socket.io/support/node-websocket-client/test/test-ready-state.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// Verify that readyState transitions are implemented correctly
|
||||
|
||||
var assert = require('assert');
|
||||
var WebSocket = require('../lib/websocket').WebSocket;
|
||||
var WebSocketServer = require('websocket-server/ws/server').Server;
|
||||
|
||||
var PORT = 1024 + Math.floor(Math.random() * 4096);
|
||||
|
||||
var wss = new WebSocketServer();
|
||||
wss.listen(PORT, 'localhost');
|
||||
wss.on('connection', function(c) {
|
||||
c.close();
|
||||
});
|
||||
|
||||
var ws = new WebSocket('ws://localhost:' + PORT);
|
||||
assert.equal(ws.readyState, ws.CONNECTING);
|
||||
ws.onopen = function() {
|
||||
assert.equal(ws.readyState, ws.OPEN);
|
||||
|
||||
ws.close();
|
||||
assert.ok(ws.readyState == ws.CLOSING);
|
||||
};
|
||||
ws.onclose = function() {
|
||||
assert.equal(ws.readyState, ws.CLOSED);
|
||||
wss.close();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue