KB Article #181785

When using SignalR, websocket connections to API Gateway fail at calls to /negotiate

Problem

When connecting to API Gateway with SignalR, you see failed calls to your websocket like:

POST /websocket/negotiate?negotiateVersion=1

Resolution

This is caused by an extension that the API Gateway does not support. It is necessary to use option.SkipNegotiation in your SignalR configuration to skip SignalR's negotiation step, e.g.


_signalRConnection = new HubConnectionBuilder()
.WithUrl(this._hubUrl, option =>
{
  option.Headers.Add("Authorization", "Basic <credentials here>");
  option.Transports = Microsoft.AspNetCore.Http.Connections.HttpTransportType.WebSockets;
  option.SkipNegotiation = true;
})
.ConfigureLogging(logging =>
{
})
.Build();