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.
Turn by Turn game: Use SignalR or both SignalR and REST API?
Asked Answered
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.
© 2022 - 2024 — McMap. All rights reserved.