nenoNaninu / TypedSignalR.Client.DevTools

SignalR development tools inspired by SwaggerUI.
MIT License
47 stars 3 forks source link

404 - Failed to complete negotiation #82

Closed jonmotos closed 6 months ago

jonmotos commented 6 months ago

Hi, firstly this is a fantastic library, we love the Swagger-like interface, really a huge benefit. I'm having somewhat a strange issue. When opening the signalr-dev page, everything loads as normal, I see the SignalR Hub methods. However, when I click "Connection to Hub", I receive: Exception occurred: Error: Failed to complete negotiation with the server: Error: Not Found: Status code '404' Either this is not a SignalR endpoint or there is a proxy blocking the connection.

When I log the full request log, I see the following URL being hit: http://localhost:55073/signalr-dev/chat/negotiate My hub is configured as: app.MapHub<ChatHub>("chat");

It seems like the URL should exclude the "/signalr-dev" part of the path? This did work fine the first time I started the app up, but clearly I changed something to break it in the meantime.

Any thoughts on either where my configuration could be wrong, or is there possibly some bug here? Thanks

jonmotos commented 6 months ago

Ah-hah! I got it! Everything works fine with the following: app.MapHub<ChatHub>("/chat");

What do you think, would you consider this a bug?

nenoNaninu commented 6 months ago

I don't think it's a bug; if there's an advantage to passing strings to MapHub that don't start with /, I will consider an improvement.

jonmotos commented 6 months ago

Hi nenoNaninu, sorry for the automated response there - I just noticed a product I was testing went rogue! I believe the advantage may be that the Microsoft method, MapHub, accepts the version without the "/" as valid, and handles mapping everything correctly to the path "/chat". It is only this library that then fails when trying to negotiate the connection via the Web interface. And it does not fail with an easily debuggable message, I had to look at the browser requests to debug the issue.