0
votes

I'm using SignalR to send messages between a website and a Windows Phone app (Windows Phone 8.0, silverlight).

In the Windows phone app, I use the SignalR client from Nuget Microsoft.AspNet.SignalR.Client, it seems to work fine to send messages, but it takes several seconds to receive them.

this.connection = new HubConnection("http://myapp.azurewebsites.net/");
this.theHub = connection.CreateHubProxy("myHub");
await connection.Start();
this.theHub.On<String>("message",
            string=>
                {
                    // Here I receive the message very late
                });

On the javascript side, messages arrive without delay.

Is there anything to configure on Windows Phone ?

1
No nothing should need configured for a Windows Phone in particular. If you can I would enable logging "connection.logging = true;" , and see what the hub is doing client side.user685590
Try using a different transport (e.g. long polling) and see if it helps. I think I have seen a bug about messages being delayed by a few secs when using the default transport on the phone.Pawel
Yes, adding a long polling transport when starting the connection solved the problem. Now it's ok await connection.Start(new LongPollingTransport());glacasa

1 Answers

2
votes

I had to use a Long polling transport, because the default transport delayed the messages.

The transport can be set when startig the connection :

await connection.Start(new LongPollingTransport());

as said in the comment below, a WebSocket transport is probably better

await connection.Start (new WebSocketTransport());