From d92f1131a721ef918a1eae28abc7456b1cfbd212 Mon Sep 17 00:00:00 2001 From: tuf <56236951+TufanMeric@users.noreply.github.com> Date: Mon, 14 Aug 2023 14:52:26 +0300 Subject: [PATCH] WebSocketTransport: Replace "http*" with "ws*" --- package.json | 2 +- src/Transports/WebSocketTransport/WebSocketTransport.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 62a56d4..a69289f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "soketto-client", - "version": "1.0.2-release", + "version": "1.0.3-release", "author": "Tufan MeriƧ Uyguner", "license": "MIT", "keywords": [], diff --git a/src/Transports/WebSocketTransport/WebSocketTransport.ts b/src/Transports/WebSocketTransport/WebSocketTransport.ts index 16cc581..8c45118 100644 --- a/src/Transports/WebSocketTransport/WebSocketTransport.ts +++ b/src/Transports/WebSocketTransport/WebSocketTransport.ts @@ -38,6 +38,9 @@ export class WebSocketTransport implements ITransport { connect(serverAddr: string): void { if (this._ws) throw new Error("Already connected or connecting"); + serverAddr = serverAddr.replace("http", "ws"); + serverAddr = serverAddr.replace("https", "wss"); + this._ws = new WebSocket(serverAddr); this._ws.binaryType = "arraybuffer"; this._ws.onopen = () => {