0
votes

I am trying to run my signalR application but i am getting the following error : "

WebSocket connection to 'ws://localhost:60377/signalr/connect?transport=webSockets&clientProtocol=2.1&connectionToken=f8tOcpqdXVZ245%2BvWKsSFHaGfl6GePMtKf0Jk9wSIJQxsa5KnEiZFyGoFgYuwbQ%2FirsDjiX%2FHtVRJAvhvmOtrvYJpaZD21GHiyyqBw785nI2TICxJ4P33puQnEnjGSlMpmMBxtNk02XxkTJpZxvClw%3D%3D&connectionData=%5B%7B%22name%22%3A%22geologuehub%22%7D%5D&tid=4' failed: Error during WebSocket handshake: Unexpected response code: 500"

I would appreciate any help to fix this problem.

2

2 Answers

0
votes

This can happen when:

  1. Your hub is not an public class.
  2. Your server can't instantiate the hub.
  3. You'r making an https connection when your server runs on http and vice-versa.
0
votes

Adding the a list of fall-back transports on the javascript fixed the problem. it is weird because i am using googleChrome (Version 77.0.3865.90) and the web socket is not supported!!

  $.connection.hub.start({ transport: ['serverSentEvents', 'longPolling'] }).done(function ()
  {
       console.log(`SignalR connection transport used is "${$.connection.hub.transport.name}"`);
  });