Junaid Shahid

Junaid Shahid

  • 318
  • 5.8k
  • 132.5k

Xamarin SignalR Connectivity with ASP.NET Core SignalR Hub

Sep 1 2019 11:42 AM
In Xamrin SignalR show connection status "disconnected".
 
  1. protected override async void OnAppearing()  
  2.         {  
  3.             base.OnAppearing();  
  4.   
  5.             connection = new HubConnectionBuilder()  
  6.                 .WithUrl("http://localhost:26523/chat")  
  7.                 .Build();  
  8.   
  9.             connection.On<stringstring>("Send", (name, message) =>  
  10.             {  
  11.                 SignalRResult.Text = name + " - " + message;  
  12.             });  
  13.   
  14.             if (connection.State == HubConnectionState.Disconnected)  
  15.             {  
  16.                 try  
  17.                 {  
  18.                     await connection.StartAsync();  // Not working
  19.                 }  
  20.                 catch (Exception ex)  
  21.                 {  
  22.                     //messagesList.Items.Add(ex.Message);  
  23.                 }  
  24.             }  
  25.   
  26.         }  
 I'm running the SignalR Hub in my local IIS. Web client working fine, Xamrin client not establishing connection.

Answers (11)