Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

websocket

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

websocket - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

2

lib/websocket.js

@@ -7,3 +7,3 @@ module.exports = {

"request" : require('./WebSocketRequest'),
"version" : "0.0.15"
"version" : "0.0.16"
};

@@ -80,3 +80,2 @@ /************************************************************************

this.serverConfig = serverConfig;
this.readHandshake(httpRequest);
};

@@ -86,3 +85,4 @@

WebSocketRequest.prototype.readHandshake = function(request) {
WebSocketRequest.prototype.readHandshake = function() {
var request = this.httpRequest;
this.host = request.headers['host'];

@@ -95,3 +95,2 @@ if (!this.host) {

if (!this.key) {
this.reject(400, "Client must provide a value for Sec-WebSocket-Key.");
throw new Error("Client must provide a value for Sec-WebSocket-Key.");

@@ -104,10 +103,11 @@ }

if (!this.websocketVersion) {
this.reject(400, "Client must provide a value for Sec-WebSocket-Version.");
throw new Error("Client must provide a value for Sec-WebSocket-Version.");
}
if (this.websocketVersion !== '8') {
this.reject(426, "Unsupported websocket client version.", {
var e = new Error("Unsupported websocket client version: " + this.websocketVersion);
e.httpCode = 426;
e.headers = {
"Sec-WebSocket-Version": "8"
});
throw new Error("Unsupported websocket client version. Client requested version " + this.websocketVersion + ", but we only support version 8.");
};
throw e;
}

@@ -114,0 +114,0 @@

@@ -138,7 +138,13 @@ /************************************************************************

WebSocketServer.prototype.handleUpgrade = function(request, socket, head) {
var wsRequest = new WebSocketRequest(socket, request, this.config);
try {
var wsRequest = new WebSocketRequest(socket, request, this.config);
wsRequest.readHandshake();
}
catch(e) {
console.error((new Date()) + " WebSocket: Invalid handshake: " + e.toString());
wsRequest.reject(
e.httpCode ? e.httpCode : 400,
e.message,
e.headers
);
console.error((new Date()) + " WebSocket: Invalid handshake: " + e.message);
return;

@@ -145,0 +151,0 @@ }

@@ -6,3 +6,3 @@ {

"author": "Brian McKelvey <brian@worlize.com>",
"version": "0.0.15",
"version": "0.0.16",
"repository": {

@@ -9,0 +9,0 @@ "type": "git",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc