xen-orchestra icon indicating copy to clipboard operation
xen-orchestra copied to clipboard

Wip feat(xo-web): send notification

Open fbeauchamp opened this issue 3 years ago • 0 comments

Check list

Notification Server is a browser specific endpoint ( firebase cloud messging for chrom{e|ium} mozilla for firefox) a subscription lookslike this :

const pushSubscription = {
  endpoint: '.....',
  keys: {
    auth: '.....',
    p256dh: '.....'
  }
};

image

sequenceDiagram
    participant notificationServer
    participant serviceworker
    participant front
    participant backend
    participant storage
    
    Note over backend: first start
    backend->>backend: Generate vapid key
    backend ->> storage: store public and private vapid key

    Note over backend: next start
    backend ->> storage: ask for vapid keys
    storage ->> backend: public and private vapid key
    
    Note over front: register new client
    front ->> backend: ask for public key
	  backend ->> front: public vapid key
    front->>serviceworker: Register
    serviceworker ->> notificationServer: Register 
    notificationServer ->> serviceworker: Subscription 
    serviceworker ->> backend: Subscription
    backend ->> storage: userId, subscription
    
    Note over backend: send notification to client
    backend ->> storage: userId
    loop for each subscription associated to this account
    storage ->> backend: subscription
    backend ->> notificationServer : subscription + payload
    notificationServer ->> serviceworker: payload
    serviceworker ->> front: notification
    end

Check if done, if not relevant leave unchecked.

  • [ ] PR reference the relevant issue (e.g. Fixes #007 or See xoa-support#42)
  • [ ] if UI changes, a screenshot has been added to the PR
  • [ ] documentation updated
  • CHANGELOG.unreleased.md:
    • [ ] enhancement/bug fix entry added
    • [ ] list of packages to release updated (${name} v${new version})
  • I have tested added/updated features (and impacted code)
    • [ ] unit tests (e.g. cron/parse.spec.js)
    • [ ] if xo-server API changes, the corresponding test has been added to/updated on xo-server-test
    • [ ] at least manual testing

Process

  1. create a PR as soon as possible
  2. mark it as WiP: (Work in Progress) if not ready to be merged
  3. when you want a review, add a reviewer (and only one)
  4. if necessary, update your PR, and re- add a reviewer

From the Four Agreements:

  1. Be impeccable with your word.
  2. Don't take anything personally.
  3. Don't make assumptions.
  4. Always do your best.

fbeauchamp avatar Oct 07 '21 08:10 fbeauchamp