Events
Description
When a client calls this endpoint, the server does not return immediately, but keeps the connection open until it is explicitly disconnected or a network error occurs. This method is called Server Sent Events (SSE), and is a way for the server to notify connected clients about server side events. Event are sent from the server to the client via the open connection. Whan a new client connects, the server immediately sends a clientRegistered event to the client. This event contains information about the client's supported report area(s) and whether there are any unread reports available. If there are any unread reports, the client should download them, perform processing and mark the reports as read. After that, the client should wait for new events from the server.
Endpoint path
Required scopes
To be able call this endpoint, the HelseId client must have one of the following scopes:
nhn:melde/delivery/restricted-accessnhn:melde/delivery/full-access
Response
This endpoint does not return a response the normal way. Insted it keeps the connection open and use it as an event transport route to the client. The events sent from the server are wrapped in a standard SSE 'envelope'. The event payload looks like this:
{
"ReportArea": nn, // Report area id
"EventType": "", // One of clientRegistered, newReport, reportDeleted
"ReportRef": "", // Report reference or null if not relevant
"HasNewReports": true|false // true, false or null if not relevant
}
There are three types of events:
clientRegistered
Sent from the server to a newly connected client, to confirm connection and tell the client to download unread reportsnewReport:
Sent to connected clients when Melde has new reports for the supported report area available for downloadreportDeleted:
Due to GDPR Melde must delete reports after 4 months. When this happens, the server sends this event to notify clients
See Swagger UI for more information