Is it possible to create Custom Push Notifications with a REST service backed server?
Asked Answered
E

2

6

I have an OpenEdge database, I have created a REST Service and am able to CRUD to it from the outside World. I have created a Nativescript app that can pull data from the REST service etc, but now i want Push notifications.

I know about the Progress Kinvey backend, and Firebase backend with their push notification features but i don't want to use them.

is there a way to create my own Push notifications on my REST server etc?

Electrocute answered 2/10, 2018 at 12:18 Comment(1)
Don't confuse REST for an API that offers CRUD and pretty URIs almost exclusively for JSON based content. With high certainty this is just an RPC driven API communicating via HTTP. Application following a REST architecture will use the same concepts used for browser-based Web pages, i.e. content-type negotiation, annotated links to give the URI some human-understandable meaning and request-response design that in total make clients robust to changes and give servers the freedom to evolve freely. If you want push notifications you should probably have a look into Web sockets.Grillage
F
2

So first I would like you to understand how Push Notification works just to make sure we are on same page,

Once your app is installed, you can query for a unique token and save it in your backend for future use. Whenever you want to send a push notification, you have communicate with APNs (Apple Push Notification Server) / FCM (Firebase Cloud Messaging) in order to send a push notification to your iOS / Android device using the unique token you acquired earlier.

So now you must use Firebase as that is the only way you can communicate with Android, yet you may choose to communicate with APNs yourself. But in my opinion, it will be a overhead for you as both have their own protocols, you will have to distinguish your tokens between iOS & Android, use appropriate protocols etc.,

I would suggest you to go with just Firebase plugin (until you are super familiar with APNs already), so you don't have to worry which platform the token belongs to, update / revoke invalid tokens over time etc., FCM has pretty decent APIs & Documentation that can make your life easy here.

Fabrizio answered 2/10, 2018 at 13:45 Comment(5)
This answer doesn't make much sense? Apple Push Notification Server? iOS / Android is never mentioned in the post.Sanitary
I believe the question was about NativeScript which is the framework for building iOS and Android apps, so it makes totally sense to me.Fabrizio
The backend seems to be OpenEdge according to tags. I suppose the backend should invoke the push.Sanitary
Of course, but until you understand how Push Notification works and why there is APNs / FCM how you do expect to build your own push server irrespective of what backend programming language you use. It's been long time after I switched to Firebase completely, but I recall APNs still uses sockets for communication and it will simply disconnect over time for various reasons you will have to connect back and make sure you don't hit a same device twice, revoke invalid tokens. My point was simply that you can't avoid FCM as it's only option for Android, so just use the same for iOS to make job easyFabrizio
I have considered FirebaseElectrocute
H
1

i strongly recommend you to see my answer here answer here.

from it:

  1. when you want to pull anything from place_1(e.g. api) to place_2(e.g. browser_client) you most have an identifier of the place_1_resource (which commonly is the uniform-resource-locator of api)
  2. when you want to push anything from place_1(e.g. notification_central_server) to place_2(cellphone_client) you most have an identifier of the place_2_resource

if you don't have any identifier for a cellphone which you want to send it a notification, your server dont know where to send that notification so we need a resource_identifier_like for cellphones which is actually a device_token_like and you have just one approach to get this device_token_like and that is the FCM/APNS

Horary answered 18/10, 2020 at 0:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.