npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@things-factory/notification

v4.3.563

Published

module related web push notification service

Downloads

1,539

Readme

module - Notification

  • 사용자에게 알림을 전달하는 기능
  • 백그라운드 알림 (Push notification)
    • 사용자가 어플리케이션을 사용하는 중이 아니더라도 알림을 전달
    • 웹푸시 기능을 사용하며, Firebase Cloud Messaging (FCM)을 사용한다.
  • 클라이언트 알림 (In-app messaging)
    • 사용자가 어플리케이션을 사용하는 중에 알림을 전달
    • 웹푸시 기능을 사용할 수 없거나, 백그라운드 알림 기능 사용을 원하지 않을 때, 웹소켓을 사용하여 어플리케이션 사용 중에만 알림을 전달한다.
  • 오류 알림
    • 사용자가 어플리케이션 조작 중에 발생하는 오류 등을 유지

terminology

  • notification
    • 코드 상의 notification 용어는 주로 알림과 관련한 데이타 형식을 의미한다.
  • notify
    • 사용자에게 알림을 전달하는 행위를 의미한다.

techonologies

  • web push notification
  • fcm
  • service worker

middlewares

  • notification-middleware
    • koa-context의 state에 notify 라는 함수를 전달한다.
    • 코드 내에서는 notify함수를 사용해서 알림을 전달할 수 있다.
    • notify 기능의 표준화를 위해서 제공된다.
  • directive-notification
    • resolver 수행 이후에 자동으로 해당 도메인의 사용자들에게 알림을 전달한다.
    • TODO more descriptions about directive notification

security

  • 매우 강력한 보안 기준을 만족해야 pubsub 채널에 조인할 수 있다.
  • websocket은 tenancy 인증을 완료한 사용자로부터의 연결 요청만을 허가한다.
  • 해당 tenancy(domain)의 jwt-authentication을 가지고 있어야만 pubsub 그룹에 조인할 수 있다.

common elements

  • notification-setting-let

notification-setting-let

  • notification-badge

notification-badge

  • notification-list

notification-list

usages

configuration

  • config.(development|production).js
  notification: {
    fcm: {
      serviceAccount: {
        project_id: "----",
        private_key: "-----BEGIN PRIVATE KEY-----\nMIIEvQIB-----END PRIVATE KEY-----\n",
        client_email: "-----"
      },
      appConfig: {
        apiKey: '-----',
        projectId: '-----',
        messagingSenderId: '-----',
        appId: '-----'
      }
    },
    serverKey: '-----',
    vapidKey: {
      subject: 'mailto:[email protected]',
      publicKey: '-----',
      privateKey: '-----'
    }
  }
  • you can get serviceAccount configuration from firebase console

get service account config

  • you can get app configuration from firebase console

get app config menu get app config

  • you can get serverKey from firebase console

get server key config

  • you can get vapidKey from firebase console

get vapidkey menu get vapid public key get vapid private key

test

test on chrome dev

  • push test on chrome samples (outside url)
{
  "notification": {
    "title":"Congratulations on your performance",
    "body": "Daily Acheivement",
    "image": "https://d2mvzyuse3lwjc.cloudfront.net/doc/en/UserGuide/images/Pie_Of_Pie_Chart/Pie_Of_Pie_Chart.png?v=83478",
    "url": "https://github.com/klaude416/wms-notebook/blob/master/step5_shipping.ipynb"
  }
}
  • inside url sample
{
  "notification": {
    "title":"Congratulations on your performance",
    "body": "Daily Acheivement",
    "image": "https://d2mvzyuse3lwjc.cloudfront.net/doc/en/UserGuide/images/Pie_Of_Pie_Chart/Pie_Of_Pie_Chart.png?v=83478",
    "url": "http://board.localhost:3000/system"
  }
}
  • sample with actions
{
  "notification": {
    "title":"Congratulations on your performance",
    "body": "Daily Acheivement",
    "image": "https://d2mvzyuse3lwjc.cloudfront.net/doc/en/UserGuide/images/Pie_Of_Pie_Chart/Pie_Of_Pie_Chart.png?v=83478",
    "url": "https://github.com/klaude416/wms-notebook/blob/master/step5_shipping.ipynb",
    "actions": [{
      "action": "save", "title": "save"
    }, {
      "action": "delete", "title": "delete"
    }]
  }
}

push test on chrome push test on chrome result

test on firebase

push test on firebase push test on firebase push test on firebase push test on firebase result