fix(apis/websocket): fix undefined error

This commit is contained in:
PalmDevs
2024-07-14 00:20:24 +07:00
parent 5aeade122b
commit 2f03800c61

View File

@@ -55,7 +55,7 @@ export default class Client {
send<T extends ServerOperation>(packet: Omit<Packet<T>, 's'>, sequence?: number) { send<T extends ServerOperation>(packet: Omit<Packet<T>, 's'>, sequence?: number) {
this.#throwIfDisconnected('Cannot send packet to client that has already disconnected') this.#throwIfDisconnected('Cannot send packet to client that has already disconnected')
this.#socket.send(serializePacket({ ...packet, s: sequence ?? this.currentSequence++ } as Packet<T>), err => { this.#socket.send(serializePacket({ ...packet, s: sequence ?? this.currentSequence++ } as Packet<T>), err => {
throw err if (err) throw err
}) })
} }