We are connecting to our signaR service from the Angular UI using the @microsoft/signalr component provided by Microsoft. We are able to connect to the server all ok when we do not have a bearer authorization cookie sent. But when we send a cookie to the signalR service we see the below error:
Error: Failed to start the connection: Error: Unable to connect to the server with any of the available transports. Error: WebSockets failed: Error: WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets.If you have multiple servers check that sticky sessions are enabled.
We have tested the signalR service via a .Net windows application and it works all ok there. We also tested connecting to service via Postman using websockets and we have no issues there either. We have tried numerous ways to try a work around this issue but to no avail.
I have tried to connect to the server via postman and a windows app and it works as expected
public init() {
let token = "OKTA token";
let tokenValue = '';
if (token !== '') {
tokenValue = '?token=' + token;
}
this.hubConnection = new signalR.HubConnectionBuilder
.withUrl("https://server:25247/netshub/",{// +tokenValue
accessTokenFactory: () => {
return token;
}
})
this.hubConnection.start().catch((err) => console.error(err.toString()));
}