cloudstorm
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -53,2 +53,3 @@ "use strict"; | ||
this._closing = false; | ||
this.client.emit("debug", `Shard ${this.id} connecting to gateway`); | ||
return this.betterWs.connect(); | ||
@@ -318,6 +319,4 @@ } | ||
this._closing = false; | ||
if (gracefulClose) { | ||
if (gracefulClose) | ||
this.clearHeartBeat(); | ||
this.betterWs.removeAllListeners(); | ||
} | ||
this.emit("disconnect", code, reason, gracefulClose); | ||
@@ -324,0 +323,0 @@ } |
@@ -68,3 +68,2 @@ "use strict"; | ||
return this._checkDisconnect(); | ||
shard.connector.connect(); | ||
}); | ||
@@ -71,0 +70,0 @@ } |
@@ -40,3 +40,3 @@ /// <reference types="node" /> | ||
constructor(address: string, options: import("../Types").IClientWSOptions); | ||
get status(): 1 | 2 | 3 | 4; | ||
get status(): 2 | 3 | 4 | 1; | ||
connect(): Promise<void>; | ||
@@ -43,0 +43,0 @@ close(code: number, reason?: string): Promise<void>; |
@@ -13,3 +13,2 @@ "use strict"; | ||
const util_1 = __importDefault(require("util")); | ||
const Z_SYNC_FLUSH = zlib_1.constants.Z_SYNC_FLUSH; | ||
const Constants_1 = require("../Constants"); | ||
@@ -50,3 +49,2 @@ const RatelimitBucket_1 = __importDefault(require("./RatelimitBucket")); | ||
const key = (0, crypto_1.randomBytes)(16).toString("base64"); | ||
this.emit("debug", "Creating connection"); | ||
const url = new URL(this.address); | ||
@@ -120,2 +118,3 @@ const req = (0, https_1.request)({ | ||
internal.closePromise = promise; | ||
return promise; | ||
} | ||
@@ -193,6 +192,5 @@ sendMessage(data) { | ||
} | ||
if (internal.closePromise) { | ||
// @ts-ignore | ||
// @ts-ignore | ||
if (internal.closePromise) | ||
internal.closePromise.resolve(void 0); | ||
} | ||
} | ||
@@ -239,3 +237,3 @@ _onReadable() { | ||
// @ts-ignore | ||
data = z._processChunk(message, Z_SYNC_FLUSH); | ||
data = z._processChunk(message, zlib_1.constants.Z_SYNC_FLUSH); | ||
} | ||
@@ -247,3 +245,3 @@ catch (e) { | ||
if (message[l - 4] !== 0 || message[l - 3] !== 0 || message[l - 2] !== 255 || message[l - 1] !== 255) | ||
this.emit("debug", "discord actually does send fragmented zlib messages. if you see this error let me know"); | ||
this.emit("debug", "discord actually does send fragmented zlib messages. If you see this error let me know"); | ||
// @ts-ignore | ||
@@ -265,4 +263,6 @@ z.close = z._c; | ||
} | ||
if (!data) | ||
return; // This should never run, but TS is lame | ||
if (!data) { | ||
this.emit("debug", "Data from zlib processing was null. If you see this error let me know"); // This should never run, but TS is lame | ||
return; | ||
} | ||
packet = this.encoding === "json" ? JSON.parse(String(data)) : readETF(data, 1); | ||
@@ -269,0 +269,0 @@ } |
{ | ||
"name": "cloudstorm", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "Minimalistic Discord Gateway library", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
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
119184
2267