dep: add socket.io-client

This commit is contained in:
CrescentLeaf
2025-09-08 03:08:11 +08:00
parent 2869a77abd
commit 0e14bb9a45
2 changed files with 6 additions and 3 deletions

View File

@@ -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

View File

@@ -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"
}
}