BlackMouse
BlackMouse

Reputation: 4552

Use iphone push notifications to update a game

I'm making a turned based poker game and trying to figure out the best way to deal with the push notifications.

Say that its 5 people in the game. After the first person has made his move, I send a push notification to the second player, saying that it's his turn.

However, I would like to notify the other players too that a turn has happened, and update the user interface for them, but only if they have the game active. If they get a push notification for each and every turn, they going to get annoyed.

Is it possible to send a push notification without alerting the user? (or is there any other way to send a message to the users phone to let them know a turn have happened)

I'm trying to avoid the overhead from constantly communicating with the server and check for updates.

Thanks

Upvotes: 2

Views: 266

Answers (1)

MrTJ
MrTJ

Reputation: 13192

No, push notification should be used only for waking up a suspended application. If you want to update the user interface only when your application is active, maintain an active socket connection to your server and then you can send messages in both direction, also from the server to the client asynchronously. This way you can also avoid pinging the server continuously. It might be a bit more difficult to code then NSURLConnection but this is the way to go.

Upvotes: 3

Related Questions