Pergunta

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 ?

Foi útil?

Solução

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());
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top