websocket13
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -8,3 +8,3 @@ /** | ||
var webserver = require('http').createServer(function(req, res) { | ||
res.statusCode = 403; | ||
res.writeHead(403, {"Content-Type": "text/html"}); | ||
res.end("<html><body><h1>Forbidden</h1>This server only accepts WebSocket connections.</body></html>"); | ||
@@ -77,2 +77,6 @@ }); | ||
}); | ||
socket.on('latency', (time) => { | ||
console.log("Client from " + socket.handshakeData.remoteAddress + " has latency: " + time + " ms"); | ||
}); | ||
}); |
@@ -150,2 +150,3 @@ var WS13 = require('./index.js'); | ||
this._pingValue = bytes.readUInt32BE(0); | ||
this._pingTime = Date.now(); | ||
@@ -313,2 +314,3 @@ this._sendFrame({ | ||
if (frame.payload && frame.payload.length == 4 && frame.payload.readUInt32BE(0) == this._pingValue) { | ||
this.emit('latency', Date.now() - this._pingTime); | ||
this._pingFailures = 0; | ||
@@ -315,0 +317,0 @@ this._queuePing(); |
@@ -65,2 +65,3 @@ var WS13 = require('./index.js'); | ||
this.headers['sec-websocket-version'] = WEBSOCKET_VERSION; | ||
this.headers['user-agent'] = this.headers['user-agent'] || "node.js/" + process.versions.node + " (" + process.platform + " " + require('os').release() + " " + require('os').arch() + ") node-websocket13/" + require('../package.json').version; | ||
@@ -67,0 +68,0 @@ if (this.options.protocols) { |
@@ -221,2 +221,4 @@ var WS13 = require('./index.js'); | ||
} | ||
this.emit('connected'); // perform connect tasks | ||
} |
{ | ||
"name": "websocket13", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Simple WebSocket protocol 13 client with no native or heavy dependencies", | ||
@@ -5,0 +5,0 @@ "author": "Alexander Corn <mckay@doctormckay.com>", |
@@ -9,4 +9,4 @@ # WebSockets for Node.js | ||
This is a pure-JavaScript implementation of [WebSockets version 13](https://tools.ietf.org/html/rfc6455). | ||
It has only one lightweight dependency. Presently it can only establish connections to WebSocket servers (as a client), | ||
but server support is [planned](#planned-features). | ||
It has only one lightweight dependency. It can establish connections to WebSocket servers (as a client), and also accept | ||
connections from clients (as a server). | ||
@@ -13,0 +13,0 @@ **Requires node.js v4.0.0 or later.** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
84981
1132