I have been implementing an application (angular + .net core) and I am using signalR.
When I am testing the signalR with pc browsers (chrome and firefox) everything works fine. However, when I open my app with my phone, signalR does not work.
I am initializing the hub like this.
this.signalingHub = new signalR.HubConnectionBuilder()
.withUrl('https://localhost:5142/signaling')
.build();
await this.signalingHub.start().
then(() => {//simple logic})
.catch((error) => {//simple logic});
In catch statement, I do some tricks and I can see that this is the error message
‘Error: Failed to complete negotiation with the server: TypeError: Failed to fetch’
I was researching this issue, and I saw one recommendation tells me this
this.signalingHub = new signalR.HubConnectionBuilder()
.withUrl('https://localhost:5142/signaling', {
skipNegotiation: true,
transport: signalR.HttpTransportType.WebSockets
})
.build();
I tried it and now I am getting this error
“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.”
I was using HTTP. I wasn’t sure if the problem was related to it. I started angular with SSL connection but nothing changed. I am getting same errors.