Fix DM WebSocket
Some checks failed
Setup testing environment and test the code / build (push) Failing after 1m22s
Publish to NPM / build-and-publish (release) Successful in 30s

This commit is contained in:
2026-04-09 11:12:41 +02:00
parent 1cd629e3c1
commit b7af5497a4
2 changed files with 5 additions and 3 deletions

View File

@@ -39,11 +39,13 @@ export class DMService {
onNewConnId: this.onNewConnId,
onNewMessage: wsMessageListener,
})
this.joinWebSocketRoom().then()
}
private onNewConnId(newConnId: string) {
console.log("NetworkService: New connection id")
this.client.defaults.headers["X-WS-ID"] = newConnId;
this.joinWebSocketRoom().then()
}
/**
@@ -242,9 +244,9 @@ export class DMService {
/**
* Joins the WebSocket room to start receiving realtime messages
*/
async joinWebSocketRoom(): Promise<void> {
private async joinWebSocketRoom(): Promise<void> {
try {
const resp = await this.client.patch("chat/dm/joinWebSocketRoom", <JoinWsRoomReq>{
const resp = await this.client.patch("v2/chat/dm/joinWebSocketRoom", <JoinWsRoomReq>{
chatid: this.chatid,
userid: this.userid,
connId: WebSocketHandler.getInstance().connId,