websocket13
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -74,3 +74,3 @@ /** | ||
socket.on('debug', (msg) => { | ||
//console.log(msg); | ||
console.log(msg); | ||
}); | ||
@@ -77,0 +77,0 @@ |
@@ -290,4 +290,2 @@ var WS13 = require('./index.js'); | ||
var state = this.state; | ||
this.state = WS13.State.Closed; | ||
this.emit('disconnected', code, reason, state == WS13.State.Closing); | ||
@@ -298,10 +296,17 @@ if (state == WS13.State.Closing || state == WS13.State.ClosingError) { | ||
} else { | ||
payload = new ByteBuffer(2 + reason.length, ByteBuffer.BIG_ENDIAN); | ||
payload.writeUint16(code); | ||
payload.writeString(reason || ""); | ||
if (code != WS13.StatusCode.NoStatusCode) { | ||
payload = new ByteBuffer(2 + reason.length, ByteBuffer.BIG_ENDIAN); | ||
payload.writeUint16(code); | ||
payload.writeString(reason || ""); | ||
} else { | ||
payload = new ByteBuffer(0, ByteBuffer.BIG_ENDIAN); // don't send anything back | ||
} | ||
this._sendControl(WS13.FrameType.Control.Close, payload.flip().toBuffer()); | ||
this._socket.end(); | ||
} | ||
this.state = WS13.State.Closed; | ||
this.emit('disconnected', code, reason, state == WS13.State.Closing); | ||
break; | ||
@@ -308,0 +313,0 @@ |
@@ -29,3 +29,3 @@ exports.State = { | ||
"UnacceptableDataType": 1003, /** Terminating because either side received data that it can't accept or process */ | ||
"Reserved1": 1004, /** Reserved. Do not use. */ | ||
//"Reserved1": 1004, /** Reserved. Do not use. */ | ||
"NoStatusCode": 1005, /** MUST NOT be sent over the wire. Used internally when no status code was sent. */ | ||
@@ -38,2 +38,5 @@ "AbnormalTermination": 1006, /** MUST NOT be sent over the wire. Used internally when the connection is closed without sending/receiving a Close frame. */ | ||
"UnexpectedCondition": 1011, /** Server is terminating because it encountered an unexpected condition that prevented it from fulfilling the request */ | ||
"ServiceRestart": 1012, /** Server is terminating because it is restarting. */ | ||
"TryAgainLater": 1013, /** Server is terminating because of some temporary condition, e.g. it is overloaded. */ | ||
//"Reserved2": 1014, /** Reserved. Do not use. */ | ||
"TLSFailed": 1015 /** MUST NOT be sent over the wire. Used internally when TLS handshake fails. */ | ||
@@ -40,0 +43,0 @@ }; |
{ | ||
"name": "websocket13", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Simple WebSocket protocol 13 client with no native or heavy dependencies", | ||
@@ -5,0 +5,0 @@ "author": "Alexander Corn <mckay@doctormckay.com>", |
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
85598
1139