2 Commits

Author SHA1 Message Date
fb1555338d Update WS
Some checks failed
Publish to NPM / build-and-publish (release) Successful in 27s
Setup testing environment and test the code / build (push) Has been cancelled
2026-04-14 16:44:27 +02:00
c98c917594 Update WS 2026-04-14 16:44:19 +02:00
2 changed files with 8 additions and 1 deletions

View File

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

View File

@@ -43,6 +43,13 @@ export class WebSocketHandler {
this.connection = new WebSocket(`${environment.get().wsUrl}/v2/ws?userid=${userid}&access_token=${resp.data.token}`)
console.log("Connected to websocket successfully")
this.startListening()
this.connection.onclose = () => {
console.error("The WebSocket connection was closed unexpectedly. Reconnecting...")
setTimeout(() => {
this.connect(userid, token)
}, 3000)
}
return
} catch (e) {
console.log(e)