Closed rjculaway closed 2 years ago
I can notice one possible issue. To start with set the type of client
in the callback to RxStomp
. The property brokerURL
needs to be set through the call to https://stomp-js.github.io/api-docs/latest/classes/RxStomp.html#configure, you should call this method with only brokerURL
key. Schematic code (untested):
this.beforeConnect = (client: RxStomp): void|Promise<void> => {
return new Promise<void>((resolve, _) => {
client.configure({brokerURL: `wss://${environment.hostName}${this.webSocketUrl}${this.settings.getKey()}`});
resolve();
});
};
Since your method is actually not async, the following also might work:
this.beforeConnect = (client: RxStomp): void|Promise<void> => {
client.configure({brokerURL: `wss://${environment.hostName}${this.webSocketUrl}${this.settings.getKey()}`});
};
Hello Deepak,
Thank you for the prompt response. I have tried your solution and it seems to have solved my problem. Thank you so much for your help!
Hello,
I am new to web sockets and would really appreciate your help. I have a query parameter in my
brokerUrl
that frequently changes. Every time value of that query parameter changes I try to update thebrokerUrl
through the before connect function, but i keep getting this connection failure, and upon checking the query parameter, it still uses the old parameter I used in my brokerUrl.`
export class StompConfig extends InjectableRxStompConfig { private readonly webSocketUrl = '/api/v1/ws/connect?authorization=';
} `
Here's the code I am using, and the error i'm getting