WebSocket update
Some checks failed
Setup testing environment and test the code / build (push) Failing after 1m4s

This commit is contained in:
2026-04-05 15:52:39 +02:00
parent 52eb73374b
commit f6b5d12914
3 changed files with 4 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
export interface SDKConfig {
apiUrl: string;
cdnUrl: string;
wsUrl: string;
}
const isNode =
@@ -22,6 +23,7 @@ const getEnv = (key: string): string | undefined => {
const DefaultEnvironment: SDKConfig = {
apiUrl: getEnv('API_URL') ?? "https://api.chatenium.hu",
cdnUrl: getEnv('CDN_URL') ?? "https://cdn.chatenium.hu",
cdnUrl: getEnv('WS_URL') ?? "wss://api.chatenium.hu",
};
let currentConfig: SDKConfig = { ...DefaultEnvironment };

View File

@@ -40,7 +40,7 @@ export class WebSocketHandler {
const resp = await client.post<WSMakeTokenResp>("v2/ws/makeToken", <WSMakeTokenReq>{
userid: userid,
});
this.connection = new WebSocket(`${environment.get().apiUrl}/v2/ws?userid=${userid}&access_token=${resp.data.token}`)
this.connection = new WebSocket(`${environment.get().wsUrl}/v2/ws?userid=${userid}&access_token=${resp.data.token}`)
console.log("Connected to websocket successfully")
this.startListening()
return