1

I try to implement web server for simple turn based game in WebAPI 2.0 using REST architecture. Although the gameplay itselfs (as it's purely turn based) seems to be a good candidate for web-api based server communication I have some concerns about "game-search" functionallity. When user want to start game, the GET request to "/api/gamesearch" would be made (and wait for next player) - but HTTP is stateless protocole so is it even possible to do that?

Another important thing (corellated with previous question) - I guess it's not possible to implement "game-over" functionallity when player (whose ture is atm) doesn't send any request (do not move) in some time period after HTTP response was send by server (which assigned ture to player) ?

I have seen there is a possibility to send Protocole exchange request for switching to WebSocket but that raises another question - do WebSockets need special web-server privileges (is pure mvc hosting enough?) - I have to keep costs low as much it is possible (that's personal project - I suspect I won't even earn penny on that).

fex
  • 3,396
  • 4
  • 26
  • 44

1 Answers1

1

You will probably need to communicate with your server throughout the game sessions as well. If your game is browser-based, something like SignalR should be great for your scenario. Usins SignalR you will be able to have constant communication with your server and your sever will be able to push data to your clients.

There shouldn't be a problem to use WebApi. Here you can find a discussion about WebApi and SignalR.

Community
  • 1
  • 1
Milan Nankov
  • 1,402
  • 12
  • 14