Comparing version 10.0.0-beta.11 to 10.0.0-beta.12
@@ -10,2 +10,3 @@ /// <reference types="ws" /> | ||
private options; | ||
private closed; | ||
constructor(apikey: string, options: ConnectOptions); | ||
@@ -12,0 +13,0 @@ changeApikey(apikey: string): void; |
@@ -22,2 +22,3 @@ "use strict"; | ||
this.reconnectMessages = []; | ||
this.closed = true; | ||
this.options = Object.assign(Object.assign({}, defaultOptions), options); | ||
@@ -35,2 +36,3 @@ this.websocketEndpoint = this.options.endpoint.websocketProtocol + "://" + this.options.endpoint.host + "/ws/v3"; | ||
connect() { | ||
this.closed = false; | ||
const urlParams = new URLSearchParams({ | ||
@@ -77,3 +79,3 @@ apikey: this.apikey, | ||
this.options.closeCallback(event); | ||
if (this.options.reconnect) | ||
if (this.options.reconnect && !this.closed) | ||
setTimeout(() => { | ||
@@ -115,2 +117,3 @@ this.connect(); | ||
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.close(); | ||
this.closed = true; | ||
} | ||
@@ -117,0 +120,0 @@ } |
{ | ||
"name": "newsware", | ||
"version": "10.0.0-beta.11", | ||
"version": "10.0.0-beta.12", | ||
"description": "Typescript client for interacting with the Newsware API", | ||
@@ -5,0 +5,0 @@ "main": "lib/src/index.js", |
@@ -20,2 +20,3 @@ import { ConnectOptions, SubscribeOptions, WebsocketRequest, WebsocketResponse, } from "./types"; | ||
private options: Required<ConnectOptions> | ||
private closed: boolean = true | ||
@@ -39,2 +40,4 @@ constructor( | ||
connect() { | ||
this.closed = false | ||
const urlParams = new URLSearchParams({ | ||
@@ -84,3 +87,3 @@ apikey: this.apikey, | ||
this.options.closeCallback(event) | ||
if (this.options.reconnect) | ||
if (this.options.reconnect && !this.closed) | ||
setTimeout(() => { | ||
@@ -124,3 +127,4 @@ this.connect() | ||
this.socket?.close() | ||
this.closed = true | ||
} | ||
} |
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
93540
1845