Louisa Bickley
Louisa Bickley

Reputation: 297

Can't connect to SignalR server from Xamarin.Forms app

Here's my environment:

I have one solution where I implemented signalR server. It's a simple chat server. It works. It's running on the windows VM. I tried connecting and sending message from my mac (so technically a separate computer in the network) and it works!

Now, I'm trying to consume it from Xamarin.Forms iOS and Droid projects.. without any success. In PCL's App class I have:

    protected override void OnStart()
    {
        // Handle when your app starts
        try
        {
            var hubConnection = new HubConnection("10.0.1.58:49919");
            var chatHubProxy = hubConnection.CreateHubProxy("ChatHub");

            hubConnection.Start();
        }
        catch (Exception ex)
        {
            // System.UriFormatException: Invalid URI: The URI scheme is not valid.

        }
    }

System.UriFormatException: Invalid URI: The URI scheme is not valid.

What am I doing wrong?

Upvotes: 0

Views: 533

Answers (1)

Gerald Versluis
Gerald Versluis

Reputation: 33993

Try a http:// prefix and another thing to try is to end a trailing slash.

So try combinations of:

new HubConnection("http://10.0.1.58:49919");

new HubConnection("http://10.0.1.58:49919/");

new HubConnection("10.0.1.58:49919/");

Upvotes: 2

Related Questions