WebSocket update
Some checks failed
Setup testing environment and test the code / build (push) Failing after 1m4s
Some checks failed
Setup testing environment and test the code / build (push) Failing after 1m4s
This commit is contained in:
@@ -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 };
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user