Coder Social home page Coder Social logo

xfrocks / node_pubhubsubbub_pushserver Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 933 KB

Node.js push notification server which is compatible with PubSubHubbub protocol.

Home Page: http://api-pushserver-xfrocks-com.herokuapp.com

JavaScript 98.00% Shell 0.22% Dockerfile 0.05% Pug 1.73%
pubsubhubbub apn gcm wns nodejs oauth2 websub fcm

node_pubhubsubbub_pushserver's Introduction

WebSub Push Server

Build Status Coverage Status

Node.js push notification server which is compatible with WebSub protocol.

  1. Mobile application (App) that wants to receive push notifications from WebSub Publisher (Publisher) may register itself with this Push Server (Server).
  2. Server will subscribe on behalf of App with Publisher.
  3. When Publisher publishes something, Server will forward the information to App via one of the supported push services.

Deployment

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 using npm run worker. In that case, it's recommended to disable the default one by setting env var CONFIG_PUSH_QUEUE_WORKER=false.

Docker Compose

  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.

Heroku

Deploy

Usage

Subscription

Send a POST request to /subscribe:

  • hub_uri (required)
  • oauth_client_id (required)
  • oauth_token (required)
  • device_type (required): see Supported Services for explanation
  • device_id (required): see Supported Services for explanation
  • extra_data (optional)

Supported Services

Apple Push Notification

via argon/node-apn

Project configuration at /admin/projects/apn:

  • bundle_id (required): The iOS application Bundle ID
  • token, an array of...
  • key (required): The provider token key in plaintext
  • keyId (required): The ID of the key issued by Apple
  • teamId (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 Token
  • extra_data[package] = Bundle ID

Firebase Cloud Messaging

via firebase-admin (the official SDK)

Project configuration at /admin/projects/fcm, parameters:

  • project_id (required): The Google project ID
  • client_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 Token
  • extra_data[project] = Project ID

By default, the server will push data messages...

  • extra_data[notification] if specified, notification messages will be pushed instead
  • extra_data[click_action] the action associated with a user click on the notification. Corresponds to category in the APNs payload.

Google Cloud Messaging

via ToothlessGear/node-gcm

Project configuration at /admin/projects/gcm, parameters:

  • package_id (required): The Android application package ID
  • api_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 Token
  • extra_data[package] = Package ID

Huawei Push Kit

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 Token
  • extra_data[app] = App ID

Optional extra_data params:

  • badge_class, badge_with_convo: control whether to include badge in pushes
  • click_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 and content_type, convo_id or notification_id (if available)
  • notification_default_title: required to receive notification for XenForo alert because HMS requires notification title

Windows Push Notification

via tjanczuk/wns

Project configuration at /admin/projects/wns, parameters:

  • package_id (required): The Windows application package ID
  • client_id (required): The Windows client ID
  • client_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 ID
  • extra_data[package] = Package ID
  • extra_data[channel_uri] = Channel URI

node_pubhubsubbub_pushserver's People

Contributors

daohoangson avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

thanhtan1105

node_pubhubsubbub_pushserver's Issues

APN needs some changes

  1. Support for silent push (e.g. with badge only)
  2. Remove support for config.apn.notificationOptions.badge, it doesn't make sense

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.