Xamarin - SignalR Hanging on connect

jcbjoejcbjoe Member

I'm trying to connect my Xamarin app to my SignalR backend which is hosted on Azure. The issue I'm having is every time I call StartAsync() on my HubConnection it just hangs the client and the request is never completed.

I have tried break pointing through the app to make sure this is actually where the hang is happening. I have tried using the exact same code on an ASP.Net Core project to confirm the SignalR connection is working, which it is, I can connect and send commands successfully. I have tried on IOS and Android both simulators and real devices and the same issue each time. Every time I hit the StartAsync the app just hangs. Each project has the latest Xamarin and Microsoft.AspNetCore.SignalR.Client Nuget installed.

    HubConnection connection = new HubConnectionBuilder()
                    .WithUrl("URLFORCHAT")
                    .Build();

    await connection.StartAsync();

The expected result is for the client to just connect and continue through the program just like the ASP.Net Core project does. I have seen other tutorials that have the same code as me and it is in fact working.

Tagged:
Sign In or Register to comment.