Andrés Castillo
Andrés Castillo

Reputation: 35

How to use websockets and push notifications at same time

I currently run an app in php zend framework that contains a real chat using node.js and socket.io, the chat is working really good, but i need to create a service to send push notifications using the pushwoosh technology, is there any way to send the push messages in the node.js server? or i have mandatorily to create a service in zend framework, considerating that chat is running in an mobile app too, and the messages should arrive even when the app is closed.

thanks for your help.

Upvotes: 3

Views: 3203

Answers (1)

Morrisda
Morrisda

Reputation: 1420

Sending push notifications on mobile devices cannot be done stand-alone and you must take in consideration that you have to rely on third-party services.

The concept is that you don't directly send push notification to your application, but you send the request to a third party service asking to send the push notification to your registered application.

For example, these are the steps you will go through to send a push notification to an IOS application:

  1. An app enables push notifications. The user has to confirm that he wishes to receive these notifications.
  2. The app receives a “device token”. You can think of the device token as the address that push notifications will be sent to.
  3. The app sends the device token to your server.
  4. When something of interest to your app happens, the server sends a push notification to the Apple Push Notification Service, or APNS for short.
  5. APNS sends the push notification to the user’s device.

(reference: http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1)

So it's not as easy as you wish to. You won't directly send the push notification, but you will ask to apple in case of IOS or to Google's server in case of android to send it. In most case, you will have to register as developer on their dev centers and get all the tokens and certification they ask.

Upvotes: 4

Related Questions