views:

1147

answers:

3

Hello,

I'm looking for a way to get real time notification from a server in an iPhone App. I don't want to use Apple Push Notification as I have many notifications. My web service is coded in PHP, and I haven't figured out an easy way to implement this functionnality. Any idea what should I do?

Thx a lot for your help!

EDIT : I'm looking for a way to get notification only when the app is launched (otherwise, the only option IS Apple Push not.).

+3  A: 

If the app is running you can open an http connection from the app to the server and have the server hold it open, pushing data through it when you want. This is basically how COMET works.

This will only work while your app is running. If you need the notification to happen even if the user has closed the app then Apple Push Notifications are your only option.

Louis Gerbarg
Thx for your answer Louis!Yep, I read about COMET or XMPP and that looks like a solution. But would you have any example to implement it on both PHP server and Objective-c client?It seems that it requires some kind of service to run on the server, am I right?
Martin
Yes, it requires server and client support. Sorry I don't have any experience doing this sort of thing with PHP.
Louis Gerbarg
Allright so after some days looking for the best solution, I came to the conclusion to use on my Debian Server:› RabbitMQ as the message queue server, installed with the STOMP extension : http://www.rabbitmq.com/› The following Stomp Client for PHP: http://stomp.fusesource.org/documentation/php/index.html‹ The following Stomp Client for ObjectveC: http://github.com/juretta/objc-stompAnd I was able to make this solution works :)Thanks guys for your help!
Martin
A: 

agree with Louis

iDiot
Please upvote Louis's answer instead of creating a new answer that adds nothing more than a "ditto". Thank you.
mahboudz
sorry for my mistake, but actually I can't upvote...
iDiot
A: 

You must use Apple Push Notification for achieving push notifications cycle on Apple's mobile devices.

fyasar