Turn by Turn game: Use SignalR or both SignalR and REST API?
Asked Answered
A

1

4

I'm write a turn-by-turn mobile game. Each game have 2 minutes. So every two minutes server will calculate rank and generate next game to clients. I use Asp.net to write server.
I choose SignalR to communicate between client and server. I have 2 choices for implementing games:
1) Use SignalR only to communicate with clients
2) Use SignalR to notify client, and use REST API to get or update information of game.

Could you please advice me what choice is better and please explain detail.

Thanks in advance.

Arie answered 25/7, 2012 at 9:40 Comment(0)
P
4

While I am not a SignalR expert, I can definitely tell you this:

Since you have chosen SignalR, use it for all the tasks it can perform.

Sending updated information about the game to the client definitely seems like a task for SignalR. Having a separate REST api is unnecessary.

Sending a message via SignalR that the state has updated, and client should make a REST call to get the updated information, is an unnecessary extra request. I would avoid it and use SignalR to send the updated information.

Pear answered 25/7, 2012 at 10:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.