Previous Topic

Next Topic

Book Contents

Book Index

Using server sent events

You can use Server-Sent Events (SSEs) to get notified when the state of digital twins changes.

The client sends a request and server holds a connection until a new message is ready, then it sends the message back to the client while still keeping the connection open so that it can be used for another message once it becomes available. Once a new message is ready, it is sent back to the client on the same initial connection.

The SSE API for receiving change notifications is the /things endpoint:

http://localhost/things

When the endpoint is invoked with an HTTP header Accept with value text/event-stream, a Server-Sent Event stream of change notifications is created.

With SSE API /things you can only get notifications about specific changes. You specify the IDs of the Things and you can do:

SSE use cases

The use cases below show how to: