2 Commits
1.0.5 ... 1.0.7

Author SHA1 Message Date
b7af5497a4 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
2026-04-09 11:12:41 +02:00
1cd629e3c1 loadSessions hotfix
All checks were successful
Setup testing environment and test the code / build (push) Successful in 1m20s
Publish to NPM / build-and-publish (release) Successful in 27s
2026-04-08 19:18:06 +02:00
3 changed files with 8 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@chatenium/chatenium-sdk",
"version": "1.0.5",
"version": "1.0.7",
"description": "A library for interacting with the Chatenium API",
"type": "module",
"main": "dist/index.js",

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,

View File

@@ -36,8 +36,9 @@ export class SessionManager {
async loadSessions(): Promise<Session[]> {
const tokens = await this.keyring.getAll()
const sessions: Session[] = []
for (const token of tokens) {
const userData = await this.database.get("sessions", token.split(".")[0])
for (const tokenKey of tokens) {
const token = await this.keyring.get(tokenKey)
const userData = await this.database.get("sessions", tokenKey)
if (userData) {
sessions.push({
token: token,