Notifications API
Methods
Overview
The Notifications API comprises two systems: 1) REST API methods implementing asynchronous notifications management, and 2) integration with the session WebSocket to receive notifications in real-time. They are intended to complement each other, but the REST API would be sufficient to implement a polling-based client.
Client usage of the notifications system might look something like this:
- Upon startup, the client fetches the player's notification history from the REST API. This will include up to two-weeks'-worth of notifications, both read and unread. (Notifications older than two weeks are automatically deleted.)
- At the same time, the client establishes a connection to a session socket. Any new notifications will be delivered through this channel as long as it is active. (In fact it may be best to establish this connection first to avoid missing any notifications. Care should be taken to avoid displaying an unfortunately-timed message twice.)
- The client will display notifications to the user and decide when any notification counts as having been read. The client updates the REST API to mark notifications as read. This can be done as a batch.