ali afshari
ali afshari

Reputation: 62

What is the Best Transport type of SignalR for unreliable networks?

I use signalr for connection between my android game with unity and server but because of unreliability of mobile data connection (3G) web socket connection lost and reconnect periodicly. what is the best transport type in this situation? Does Server Sent Events better than WebSocket for unreliable networks? Description : client sends requests almost every 15 seconds.

Upvotes: 0

Views: 772

Answers (1)

xleon
xleon

Reputation: 6375

The transport is not the problem. If 3G goes off, it doesn´t matter what transport you are using. I suggest you to let SignalR pick the transport. You just need to implement a reconnection logic. SignalR will try to reconnect for some seconds, after a time out (don´t remember how many seconds) it won´t ever reconnect. It´s not hard to implement the logic as you can listen for connection events (connected, disconnected, reconnecting...).

Another issue is that any method your app calls (when disconnected or when trying to reconnect) will be lost in the dark. So a good idea may be some sort of caching to save those calls in a queue and re-send them once reconnection is done.

Check out how this sample handles connection, disconnections and caching of failed method calls

Upvotes: 0

Related Questions