Socket connections can listen to events from ThingsDB.
This chapter explains how and when ThingsDB sends events to socket connections. You only need to read this if you want to implement the event handling yourself. If possible, you should use a native client/connector and read the corresponding documentation on how to handle ThingsDB events as a client/connector most likely has out-of-the-box support for event handling.
There is no option to listing to event when using the HTTP API.
The following events may be received by a client:
|The connected node has changed its status.
|A warning message from ThingsDB.
|Emitted when a room is joined.
|Emitted when leaving a room (only when explicitly leaving a room, not on a client disconnect).
|a change is emitted to this room.
|A joined room is removed from ThingsDB.
0-9represents the package type in a package header.
When connected and authenticated with a socket connection, you will automatically receive [node-status-changes]((./node-status) and warning-events.
When joining one or more rooms, ThingsDB is guaranteed to return with the response on the join request before the on_join event(s) are being transmitted. The on_leave event is only transmitted when an explicit request is made to leave a room. Thus, this event is not triggered when a client disconnect, or when a node is shutting down.