Socket connections can receive events from ThingsDB. Push events do only work when using a socket connection and cannot be used with the HTTP API.
Before events are received you have to subscribe for changes.
The following events may be received by a client:
||The connected node has changed its status.|
||Initial data for the thing which is added to the watch list.|
||Update on a thing in the watch list.|
||A thing in the watch list is removed.|
||A thing is no longer being watched.|
||A warning message.|
0-5represents the package type in a package header.
When using a client, this is pretty easy, for example using the Python client:
If you want to write the request to the socket connection yourself, sending the following byte data on your socket connection will have the same result:
(See the “creating a watch request example” on how we got the above bytes code)
If you start to watch a thing, the following events will be pushed in order:
To start watching one or more things, a watch request may be used, but as an alternative it is also possible to use the functions watch() and unwatch. There is no alternative function for watching the node status.