Home Ask Login Register

Developers Planet

Your answer is one click away!

Earthling February 2016

Setting up Signal R in Android: Crash/Hung Issue

I followed THIS tutorial to set up a .NET Backend for my Android app to implement Signal R. I set up a SignalR Self-Hosted backend.

Here's my Backend Code in a Console Project:

namespace SignalRSelfHost
    class Program
        static void Main(string[] args)
            // This will *ONLY* bind to localhost, if you want to bind to all addresses
            // use http://*:8080 to bind to all addresses. 
            // See http://msdn.microsoft.com/en-us/library/system.net.httplistener.aspx 
            // for more information.
            string url = "http://localhost:8080";
            using (WebApp.Start(url))
                Console.WriteLine("Server running on {0}", url);
    class Startup
        public void Configuration(IAppBuilder app)
    public class MessageHub : Hub
        public static event Action<string, string> MessageReceived = delegate { };

        public void SendMessage(string name, string message)
            MessageReceived(name, message);


    public class CustomType
        public string Name;
        public int Id;

My Android Code:

    Handler handler;
    TextView statusField;

    protected void onCreate(Bundle savedInstanceState) {

        handler = new Handler();
        statusField = (TextView) findViewById(R.id.statusField);

        Platform.loadPlatformComponent(new AndroidPlatformComponent());
        // Change to the IP address and matching port of your Signa        


jsoques February 2016

I had similar issue a few days ago and this Github issue helped: https://github.com/SignalR/java-client/issues/63

Basically what I did was modify the WebsocketTransport.java in the signalr-client-sdk project. Replace:

uri = new URI(url);


uri = new URI(url.replace("http://", "ws://"));

around line 86 in the source code.

I can now connect and send message and recieve raw data but cannot subscribe to events...

Hope this helps you get passed your problem.

Post Status

Asked in February 2016
Viewed 1,723 times
Voted 11
Answered 1 times


Leave an answer

Quote of the day: live life