1

I am working with SignalR for the first time and trying to connect to hub from Angular. I am trying to implement the same in this LINK

I am not sure where this negotiate comes from

OPTIONS http://localhost:5001/messageHub/negotiate net::ERR_CONNECTION_REFUSED

Here is my code.

public startConnection = () => {
this.hubConnection = new signalR.HubConnectionBuilder()
  .withUrl('http://localhost:5001/messageHub')
  .build();

this.hubConnection
  .start()
  .then(() => alert('Connection started'))
  .catch(err => alert('Error while starting SignalR connection: ' + err));
}

Here is appsettings.Development.json

 "Logging": {
"LogLevel": {
  "Default": "Debug",
  "System": "Information",
  "Microsoft": "Information"
}},
"SignalR": {
"messageHub": "http://localhost:5001/messageHub"
  },
"Api": {
"GenerateTokenUrl": "http://localhost:5000/api/Values"
 }

It is giving me this error in Chrome Dev toolsmessageHub Negotiate

Tony Ngo
  • 19,166
  • 4
  • 38
  • 60
Chatra
  • 2,989
  • 7
  • 40
  • 73

0 Answers0