Node.js push notification server which is compatible with WebSub protocol.
- Mobile application (
App
) that wants to receive push notifications from WebSub Publisher (Publisher
) may register itself with this Push Server (Server
). Server
will subscribe on behalf ofApp
withPublisher
.- When
Publisher
publishes something,Server
will forward the information toApp
via one of the supported push services.
Notes:
- By default, there'll be 1 worker to push notifications by
npm start
. It is possible to have multiple separated instances of workers by usingnpm run worker
. In that case, it's recommended to disable the default one by setting env varCONFIG_PUSH_QUEUE_WORKER=false
.
app:
image: xfrocks/pushserver
environment:
- CONFIG_WEB_USERNAME=admin
- CONFIG_WEB_PASSWORD=123456
- MONGO_URI=mongodb://mongo/pushserver
- REDIS_URL=http://redis:6379
depends_on:
- mongo
- redis
ports:
- "80:18080"
See docker-compose.yml file for full example. Please note that the yml is for development purposes, it is not secure.
Send a POST
request to /subscribe
:
hub_uri
(required)oauth_client_id
(required)oauth_token
(required)device_type
(required): see Supported Services for explanationdevice_id
(required): see Supported Services for explanationextra_data
(optional)
via argon/node-apn
Project configuration at /admin/projects/apn
:
bundle_id
(required): The iOS application Bundle IDtoken
, an array of...key
(required): The provider token key in plaintextkeyId
(required): The ID of the key issued by AppleteamId
(required): The team ID associated with the provider token- Please note that if you don't configure provider token, the RSA cert/key pair is required
production
(optional): 1 for production, 0 for sandbox
App
that wants to receive via APN must include these parameters during subscription:
device_type
=ios
device_id
= APN Device Tokenextra_data[package]
= Bundle ID
via firebase-admin (the official SDK)
Project configuration at /admin/projects/fcm
, parameters:
project_id
(required): The Google project IDclient_email
(required)private_key
(required)
App
that wants to receive via FCM must include these parameters during subscription:
device_type
=firebase
device_id
= FCM Registration Tokenextra_data[project]
= Project ID
By default, the server will push data messages...
extra_data[notification]
if specified, notification messages will be pushed insteadextra_data[click_action]
the action associated with a user click on the notification. Corresponds tocategory
in the APNs payload.
Project configuration at /admin/projects/gcm
, parameters:
package_id
(required): The Android application package IDapi_key
(required): The API key for GCM (obtain via Google Developer Console)
App
that wants to receive via GCM must include theses parameters during subscription:
device_type
=android
device_id
= GCM Registration Tokenextra_data[package]
= Package ID
Project configuration at /admin/projects/hms
, parameters:
app_id
(required)app_secret
(required)
App
that wants to receive via FCM must include these parameters during subscription:
device_type
=huawei
device_id
= HMS Tokenextra_data[app]
= App ID
Optional extra_data
params:
badge_class
,badge_with_convo
: control whether to include badge in pushesclick_action
:android.notification.click_action.action
will be set to this value (type=1)intent_prefix
:android.notification.click_action.intent
will be set with this prefix andcontent_type
,convo_id
ornotification_id
(if available)notification_default_title
: required to receive notification for XenForo alert because HMS requires notification title
via tjanczuk/wns
Project configuration at /admin/projects/wns
, parameters:
package_id
(required): The Windows application package IDclient_id
(required): The Windows client IDclient_secret
(required): The Windows client secret
App
that wants to receive via WNS must include theses parameters during subscription:
device_type
=windows
device_id
= Device IDextra_data[package]
= Package IDextra_data[channel_uri]
= Channel URI