olofd / react-native-signalr

Use SignalR with React Native
150 stars 61 forks source link

How to connect to development server? #5

Closed perkola closed 8 years ago

perkola commented 8 years ago

I'm following the example code and I've set up a Hub like so:

    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.MapSignalR();
        }
    }

And my dev server can be reached from localhost:64726. However what do I replace in the following line?

var connection = signalr.hubConnection('http://<your-signalr-server-url>');

I have tried http://localhost:64726, http://10.0.2.2:64726 and more but all give the same result:

Error: Error during negotiation request.

Any ideas on how to connet my React Native App to SignalR?

Edit: trying to access http://10.0.2.2:64726 in the emulator browsers yields

Bad Request - Invalid Hostname

--------------------------------------------------------------------------------

HTTP Error 400. The request hostname is invalid.
perkola commented 8 years ago

Update: everything works. Had to use this tool to make it work.

Confirming this package works on Android (tested with RN 0.30.0.