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

cloudstorm

Package Overview
Dependencies
Maintainers
2
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudstorm - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

1

dist/connector/DiscordConnector.d.ts

@@ -46,2 +46,3 @@ /// <reference types="node" />

latency: number;
private _closing;
static readonly default: typeof DiscordConnector;

@@ -48,0 +49,0 @@ /**

10

dist/connector/DiscordConnector.js

@@ -32,2 +32,3 @@ "use strict";

this.latency = 0;
this._closing = false;
this.id = id;

@@ -52,2 +53,3 @@ this.client = client;

connect() {
this._closing = false;
return this.betterWs.connect();

@@ -59,3 +61,4 @@ }

async disconnect() {
return this.betterWs.close();
this._closing = true;
return this.betterWs.close(1000, "Disconnected by User");
}

@@ -134,3 +137,3 @@ /**

void this.client.emit("error", `Client was attempting to ${resume ? "resume" : "reconnect"} while the WebSocket was still in the connecting state. This should never happen.`);
await this.betterWs.close();
await this.betterWs.close(resume ? 4000 : 1012, "reconnecting");
if (resume)

@@ -313,4 +316,5 @@ this.clearHeartBeat();

// Don't try to reconnect when true
if (code === 1000 && reason === "Disconnected by User")
if (code === 1000 && this._closing)
gracefulClose = true;
this._closing = false;
if (gracefulClose) {

@@ -317,0 +321,0 @@ this.clearHeartBeat();

@@ -42,3 +42,3 @@ /// <reference types="node" />

connect(): Promise<void>;
close(): Promise<void>;
close(code: number, reason?: string): Promise<void>;
sendMessage(data: import("../Types").IWSMessage): Promise<void>;

@@ -45,0 +45,0 @@ private _write;

@@ -101,3 +101,3 @@ "use strict";

}
async close() {
async close(code, reason) {
const internal = this._internal;

@@ -111,3 +111,4 @@ if (internal.closePromise)

resolver = resolve;
this._write(Buffer.allocUnsafe(0), 8);
const from = Buffer.from([code >> 8, code & 255]);
this._write(reason ? Buffer.concat([from, Buffer.from(reason)]) : from, 8);
}).then(() => {

@@ -114,0 +115,0 @@ internal.closePromise = null;

{
"name": "cloudstorm",
"version": "0.4.2",
"version": "0.4.3",
"description": "Minimalistic Discord Gateway library",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

Sorry, the diff of this file is not supported yet

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