简体   繁体   中英

Is it possible to send push notification request from device to server?

currently i am thinking about using push notification service as an alternative to SMS in my applications.

What i need to do, is to send request (with data - eg user fills in text field on device, and request containing this text is sent to server via push notification service) from device to server. Server then processes this request, and sends back push notification (with some processed data) to original device.

So basically i am asking: is also device to server communication possible with push notification services?

Thank for your help.

Push notifications are only sent from server to device. You need to send data to your server, and the server sends push notification to the connected clients.

I think it's interesting to comment the difference between PUSH and PULL:

The PUSH notification is the only way you have if you want your device to be hearing everytime for news , so the news can be pushed into it (explaining how this works would answer another question in fact). However, if your device connects to a server, which is in fact always hearing , info can be sent back as an answer.

Thus, when you want a communication between the server and the device, and assuming you really need this communication work with PUSH, what you should do is:

  • Use PUSH to send data FROM SERVER TO DEVICE
  • Use HTTP Requests to send data FROM DEVICE TO SERVER

Also you should have in mind that, everytime a HTTP Request is made, the server can provide an answer (and you could use for that JSON, XML, etc).

You're confused with the phrase "Push Notifications". Ultimately, it is a way for a server to send data to a device at any time this particular device is connected. You don't call a device-to-server message a push notification. James Webster is right - just use HTTP requests.

As requested in comments, I've posted this as an answer

Why using push? Why not just sending HTTP requests?

Have a look at NSURLConnection and NSURLConnectionDelegate as these are probably the classes you'll want to use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM