-
Notifications
You must be signed in to change notification settings - Fork 375
Open
Labels
Description
This is a draft document, please feel free to comment and help.
We have (at least) two concurrent efforts that overlap but are not full implementations of a generic event system for Jupyter in themselves: jupyter-telemetry and jupyterlab-notifications.
A synthesis of these extensions with generic endpoints (i.e., not specifically designed and named for telemetry or notifications) would yield a flexible general-purpose event bus for jupyter-server-based applications.
Architecture of events API
REST Endpoints
POST/api/events- create new eventsGET/api/events/schemas- query/list registered schemas
(maybe -- needs discussion)POST/api/events/schemas- register schemas
(maybe -- needs discussion)
WebSocket endpoints (WebsocketHandler)
/api/events/subscribe- fire hose of all events -- perhaps accept filters? (see open question below)/api/events/subscribe/notification-- subscribe to events of typenotification
Open Question: Should the WebSocket handler support making a request for multiple filters to be applied instead of just the one proposed in the URL scheme above?
Depends on jupyter_events package
- exports
EventLoggerobject in (formerlyEventLoginjupyter_telemetry)
Case Study: JupyterLab Notifications
Server-side functionality
- Subscribes to all
notificationevents that pass through the event bus - Adds each
notificationas a row in a SQLite database on the server with a key for the recipient identity as well as an IDnotificationevents with multiple recipients can be de-normalized here and written as multiple rows
-
REST API
GET/api/notifications- retrieve a list of all notifications that authenticated user can seeGET/api/notifications/{ID}- retrieve a specific notificationDELETE/api/notifications/{ID}- delete a specific notification
Client-side functionality
- Subscribe to the
/api/events/notificationsWebSocketThrottleits incoming messages at some reasonable rate (on the order of 0.5-1 seconds)
- Treat incoming messages from the
eventsAPI as a notifier only -- check the/api/notificationsendpoint for the actual list of messages - Render the badge and the notification center UI inside JupyterLab/Notebook
JupyterLab 4 extension
- A
Token(e.g.,INotificationsorIEvents) that exposes anIDataConnectorfor event CRUD and anISignalfor event subscription - A visual UI for an event notification center
Jupyter Notebook 7 extension
- The
Tokenfrom the JupyterLab extension - A version of the JupyterLab UI for notifications