From 0e14bb9a453e29da2d9fe54a1df111ed806425c3 Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Mon, 8 Sep 2025 03:08:11 +0800 Subject: [PATCH] dep: add socket.io-client --- client/api/Client.ts | 6 ++++-- client/deno.jsonc | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/client/api/Client.ts b/client/api/Client.ts index 4c272bc..50e6884 100644 --- a/client/api/Client.ts +++ b/client/api/Client.ts @@ -1,4 +1,4 @@ -import { io, Socket } from 'https://unpkg.com/socket.io-client@4.8.1/dist/socket.io.esm.min.js' +import { io, Socket } from 'socket.io-client' import { CallMethod, ClientEvent } from './ApiDeclare.ts' import ApiCallbackMessage from './ApiCallbackMessage.ts' @@ -10,7 +10,9 @@ class Client { static connect() { this.socket?.disconnect() this.socket && delete this.socket - this.socket = io() + this.socket = io({ + transports: ['websocket'] + }) this.socket!.on("The_White_Silk", (name: string, data: UnknownObject, callback: (ret: UnknownObject) => void) => { try { if (name == null || data == null) return diff --git a/client/deno.jsonc b/client/deno.jsonc index 22e5106..791dc10 100644 --- a/client/deno.jsonc +++ b/client/deno.jsonc @@ -22,6 +22,7 @@ "mdui": "npm:mdui@2.1.4", "split.js": "npm:split.js@1.3.2", - "crypto-es": "npm:crypto-es@3.1.0" + "crypto-es": "npm:crypto-es@3.1.0", + "socket.io-client": "npm:socket.io-client@4.8.1" } }