Comparing version 10.0.0-beta.10 to 10.0.0-beta.11
@@ -7,3 +7,3 @@ /// <reference types="ws" /> | ||
private readonly websocketEndpoint; | ||
socket: WebSocket; | ||
socket?: WebSocket; | ||
reconnectMessages: WebsocketRequest[]; | ||
@@ -10,0 +10,0 @@ private options; |
@@ -26,4 +26,5 @@ "use strict"; | ||
changeApikey(apikey) { | ||
var _a; | ||
this.apikey = apikey; | ||
if (this.socket.readyState === isomorphic_ws_1.default.OPEN) { | ||
if (((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === isomorphic_ws_1.default.OPEN) { | ||
this.closeConnection(); | ||
@@ -104,3 +105,4 @@ } | ||
sendSocketMessage(message, resendOnReconnect = false) { | ||
this.socket.send(JSON.stringify(message)); | ||
var _a; | ||
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify(message)); | ||
if (resendOnReconnect) | ||
@@ -110,3 +112,4 @@ this.reconnectMessages.push(message); | ||
closeConnection() { | ||
this.socket.close(); | ||
var _a; | ||
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.close(); | ||
} | ||
@@ -113,0 +116,0 @@ } |
{ | ||
"name": "newsware", | ||
"version": "10.0.0-beta.10", | ||
"version": "10.0.0-beta.11", | ||
"description": "Typescript client for interacting with the Newsware API", | ||
@@ -5,0 +5,0 @@ "main": "lib/src/index.js", |
@@ -17,3 +17,3 @@ import { ConnectOptions, SubscribeOptions, WebsocketRequest, WebsocketResponse, } from "./types"; | ||
private readonly websocketEndpoint: string | ||
socket!: WebSocket | ||
socket?: WebSocket | ||
reconnectMessages: WebsocketRequest[] = [] | ||
@@ -32,3 +32,3 @@ private options: Required<ConnectOptions> | ||
this.apikey = apikey | ||
if (this.socket.readyState === WebSocket.OPEN) { | ||
if (this.socket?.readyState === WebSocket.OPEN) { | ||
this.closeConnection() | ||
@@ -116,3 +116,3 @@ } | ||
sendSocketMessage(message: WebsocketRequest, resendOnReconnect: boolean = false) { | ||
this.socket.send(JSON.stringify(message)) | ||
this.socket?.send(JSON.stringify(message)) | ||
if (resendOnReconnect) | ||
@@ -123,4 +123,4 @@ this.reconnectMessages.push(message) | ||
closeConnection() { | ||
this.socket.close() | ||
this.socket?.close() | ||
} | ||
} |
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
93189
1838