Skip to content

pdkovacs/push-notification-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Push Notification Service - PNS

PNS is an HTTP service accepting

  • WS-connection requests from an application's HTTP-clients and
  • notifications to be instantantly delivered (pushed) from the application to the application's users.

User/client-facing functions

  • User devices can connect at the POST /subscribe endpoint and remain connected to PNS with one device or multiple devices

    • the POST request carries a token (session-cookie by default) associated with the credentials of the user which is checked by the application;
    • in case the token refers to valid credentials of a user who is allowed to use the notification service, the endpoint returns the user_id
  • Each connected device of each user is notified (by PNS) of the availability of new notifications from the application via the

    { "newNotificationCountChanged": number }
    

    message. (The content (data) of the new notifications is not sent at this point.)

  • User devices can request the notification data using the

    { notificationDataRequest: { receivedAfter: string } }
    

    message. If the receivedAfter property is empty, the response will include only data for notications not yet seen. The response is sent via the

    { "notificationData": [{ notification_data: string, created_date: string, seen_date: string }] }
    

    message.


NOTE

"device" in this context translates in practice into distinct "cookied" sessions, i.e. each distinct client session counts as a distinct device.



NOTE

Notifications must be kept available until the user requests to see them (i.e. potentially for an infinite period of time) and even for some configurable period thereafter.


Application-facing functions

  • The application can request PNS to send notifications to a user's connected devices using the

    { user_id: string, notifications: [{ data: string, created_date: string }] }
    

message.

The service can be deployed either as a service separate from the application or embedded in the application as library.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages