servinglynk / hslynk-open-source-docs

Contains wiki documentation, and issue tracker for the HSLynk Open Human Services Data Exchange Platform project. Code is in a different repo: https://github.com/servinglynk/hslynk-open-source . API docs are at https://docs.hslynk.com . General website is at:
http://www.hslynk.com/
Mozilla Public License 2.0
9 stars 3 forks source link

Subscription notifications (demo set up) #910

Open suryayadavalli opened 3 years ago

suryayadavalli commented 3 years ago
  1. PITON App subscribes for notifications via HSLynk
  2. HSLynk registers/ subscribes itself with opencitylabs for notifications (for that specific client)
  3. opencitylabs notifies resthook when criteria is met
  4. HSLynk's resthook writes to websocket
  5. PITON app listens to websocket for notifications from HSLynk's rest hook.

image

Rest hook (to be registered with opencitylabs) : https://api.hslynk.com/hmis-event-service/eventnotifications Web socket URL that PITON need to listen to : realtime.hslynk.com/hmis-event-service/events-socket Specific channels (to be listened to from PITON) : To listen for all / any client's notifications : /clients To listen to notifications for a specific client using client ID : /clients/{clientid} To listen to notifications for a specific client using client's Dedup ID : /clients/{dedupclientid}

The body that is received from opencitylabs will be sent as is to the websocket (for demo purposes).

Test implementation of the complete flow https://realtime.hslynk.com/hmis-event-service/socket-test.html

suryayadavalli commented 3 years ago

@logicsandeep Sample web-socket connection html code is available in below location

https://github.com/servinglynk/hslynk-open-source/blob/bf40a41d925125984961a377480578f8fd55e236/hmis-event-service/src/main/webapp/socket-test.html

suryayadavalli commented 3 years ago

commit id: https://github.com/servinglynk/hslynk-open-source/tree/bf40a41d925125984961a377480578f8fd55e236

eric-jahn commented 3 years ago

@suryayadavalli In the diagram, I thought HSLynk was going to subscribe to alerts. Piton App would just display them when the callback comes in. Can we create a subscription endpoint Piton App can call to tell HSLynk what to subscribe to, for alerts?

suryayadavalli commented 3 years ago

@eric-jahn : Will come up with an subscription end point that PITON can call.

suryayadavalli commented 3 years ago

Client subscription API details URL: https://api.hslynk.com/hmis-event-service/rest/clients/e14b1753-7066-446f-badf-c89b0606ed0e/subscriptions

Request body

{
    "type":"COVID"
}
eric-jahn commented 3 years ago

We'll have to change this API to "event service" or something more generic, since it isn't really specific to HMIS. Any human services program dealing with COVID could use it.

suryayadavalli commented 3 years ago

@eric-jahn : name change to event-service is done. @logicsandeep and I had a meeting to go through the details of the real time notifications implementation.

Here is what's NOT included in the demo set up

  1. Storing the notifications and exposing an API for PITON to fetch all the notifications. The notifications will be sent to PITON real-time (not in a store/fetch approach)
  2. Ability to subscribe for multiple clients. Currently subscription API need to be called for each client that should be subscribed. As per @Jeni, they are working with the client Sarah at this time, so not sure if we need to have this multi client subscription API in place now.