dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.48k stars 10.03k forks source link

Add Java client transport fallback #14172

Open BrennanConroy opened 5 years ago

BrennanConroy commented 5 years ago

We added the LongPolling transport to the Java client in https://github.com/aspnet/AspNetCore/pull/6856

But it currently doesn't do fallback, so the client either connects with the selected transport or it doesn't.

noamyogev84 commented 3 years ago

Hey @BrennanConroy i'll try to grab that Can you get me started with some pin points?

BrennanConroy commented 3 years ago

Sure, the general idea is that we want to first get the negotiate response from the server which can include multiple transports, then we'll loop over all of the transports the client can use and check that the server supports them too and see if the client connects with that transport. If it throws we log and try the next one, repeat until all transports are tried and either we stop on a successful one, or return some sort of error to the user.

Most of the Typescript client code for an example is: https://github.com/dotnet/aspnetcore/blob/5223b497fe578b1c239a454a46e464866069a4dc/src/SignalR/clients/ts/signalr/src/HttpConnection.ts#L376-L408

And for the .NET Client: https://github.com/dotnet/aspnetcore/blob/5223b497fe578b1c239a454a46e464866069a4dc/src/SignalR/clients/csharp/Http.Connections.Client/src/HttpConnection.cs#L365-L424