You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using the obsolete code, my webapp works (netcoreapp3.1),
but as soon as I use the new way, in my case: endpoints.MapHub<SyncHub>("/syncHub");
I get the error:
VM68:16 Uncaught (in promise) Error: Failed to invoke 'Send' due to an error on the server.
at _this.callbacks. (:16:35838)
at HubConnection.processIncomingData (:16:38004)
at WebSocketTransport.HubConnection.connection.onreceive (:16:27722)
at WebSocket.webSocket.onmessage (:16:110678)
_this.callbacks. @ VM68:16
HubConnection.processIncomingData @ VM68:16
HubConnection.connection.onreceive @ VM68:16
webSocket.onmessage @ VM68:16
turns out using the new endpoints.MapHub you have to send the exact parameter type you defined in the Hub,
I was sending: connection.invoke("Send", key) // key being int
and in the hub I have: public async Task Send(string key)
so now I had to call toString() on key in js to make sure it is the same type as in the hub.
Uh oh!
There was an error while loading. Please reload this page.
UseSignalR and UseConnections are marked obsolete
The methods
UseConnections
andUseSignalR
, and the classesConnectionsRouteBuilder
andHubRouteBuilder
are being marked obsolete in 3.0.Version introduced
3.0
Old behavior
SignalR hub routing was configured using
UseSignalR
,UseConnections
.New behavior
The old way of configuring routing has been obsoleted and replaced with Endpoint routing.
Reason for change
We're moving middleware to the new EndpointRouting system so we're obsoleting the old way of adding middleware.
Recommended action
Replace
UseSignalR
withUseEndpoints
,Old code:
New code:
Category
ASP.NET Core
Affected APIs
Microsoft.AspNetCore.Builder.IApplicationBuilder.UseSignalR
Microsoft.AspNetCore.Builder.IApplicationBuilder.UseConnections
Microsoft.AspNetCore.Http.Connections.ConnectionsRouteBuilder
Microsoft.AspNetCore.SignalR.HubRouteBuilder
Issue metadata
The text was updated successfully, but these errors were encountered: