Reputation: 1341
in my app i'm using Parse.com as a my server provider. the app includes a chatting service which works like this: every 3 seconds i send a query and return if there is a any chats that has a date greater than the last one i queried. it works perfectly but i want my app to be more efficient because i don't want the user to losing 1 or 2 kb for every refresh every 3 seconds. i want the app to be able to receive the chats once new ones are added which i call Push. similar to the mail app, when new mails are available they get downloaded (i don't know if apple actually does that or also refresh every now and then). any suggestions?
Upvotes: 0
Views: 117
Reputation: 6731
Yup, all part of APNS.
When you send out a message, send a push to all the recipients as well.
https://parse.com/tutorials/ios-push-notifications
There's a bit to setting it up of course, but once you save the message, get the users installation and then push to them. Then you'll need to modify your appdelegate so that if a push is received while the app is open, just refresh your chat window if the user is in the chat window or perhaps just show the user some kind of alert if they are in another part of the app.
Upvotes: 1