Unable to connect to ASP.NET SignalR hub from JavaScript client

Viewed 651

I need to connect to an ASP.NET SignalR hub from JavaScript. I am using the @aspnet/signalr npm package, with the following code to connect.

connection = new signalR.HubConnectionBuilder()
    .withUrl("<link to hub>", { accessTokenFactory: () => token })
    .build();
connection.start()

The same code works to connect to an ASP.NET Core SignalR hub, but for an ASP.NET SignalR hub, it returns the following error: TypeError: Cannot read property 'length' of undefined at "HttpConnection"

Is this an issue with incompatible versions? Can the @aspnet/signalr package be used to connect to an ASP.NET SignalR hub?

1 Answers
Related