fix: 多個同 DeviceId 不同 Session 的客戶端無法同時收到消息

This commit is contained in:
CrescentLeaf
2025-09-24 22:03:23 +08:00
parent 9a3e87d89c
commit 38db2e1310
5 changed files with 15 additions and 8 deletions

View File

@@ -9,6 +9,7 @@ import randomUUID from "../randomUUID.ts"
type UnknownObject = { [key: string]: unknown }
class Client {
static sessionId = randomUUID()
static myUserProfile?: User
static socket?: Socket
static events: { [key: string]: (data: UnknownObject) => UnknownObject | void } = {}
@@ -21,7 +22,8 @@ class Client {
this.socket = io({
transports: ['websocket'],
auth: {
device_id: data.device_id
device_id: data.device_id,
session_id: this.sessionId,
},
})
this.socket!.on("connect", async () => {