views:

1067

answers:

1

Does anyone know the stepts how to create an iPhone push notifcation web service in asp.net (C#) that I can call using JSON protocol? I'd like to be able to an http request to have an alert sent to another iphone device id. Is this possible? Any sample code would be helpful.

+1  A: 

iPhone 3.0 and higher supports push notification via Apple's server, see SDK. I'd suggest you do use that technology, as that allows your app to receive messages while not running and does not result in using more batrery power than your iphone already does.

Further, as Rex M already mentioned above, Web services does not support push-technology out of the box. A way to do push over web services is what Microsoft exchange uses: to make a server call, and then to have the server block (i.e. not answer back) until the server has an update for the client. So:

  1. Client does request to server
  2. Connection between client and server is open
  3. Server blocks the request.
  4. After a while, the server wants to update the client, and then finally responds to the client.

In this model, the client needs to guard the connection between the server and the client. If for any reason dropped, the client need to start a new connection. A reason for the connection being dropped, would be that the firewall in the middle times out or may be even IIS times out.

taoufik