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 is the watch list.|
||A thing from the watch list is removed.|
||A thing has been stopped watching.|
||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 you socket connection will have the same result:
(See the “creating a watch request example” on how we got the above byte 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 node status changes.