-
Notifications
You must be signed in to change notification settings - Fork 332
Open
Labels
Description
As a developer I want to be able to observe a binary property without base64 encoding it so that the operation is more efficient.
Currently the gateway incorrectly adds observeproperty Forms using SSE for properties, even if they use a contentType other than JSON (e.g. an ImageProperty). This is incorrect because binary payloads can not currently be observed over SSE unless they are base64 encoded. But maybe we should think about ways to make this possible...
From a discussion on the WoT Community Discord:
You want to observe an image?
Hmm, a few options:
- The oldschool way used by IP cameras to stream MJPEG - use the multipart/x-mixed-replace Content-type header to tell the client you're going to keep sending a series of separate images and the client should keep replacing the image with a new one. I've never tried this but I think it's natively supported by the
element in web browsers, if that's how you're displaying the received images.
- WebSockets - The server can push binary data whenever it wants (just not mixed inside a text-based message). This is more efficient but requires some work on the client-side to handle the binary blobs and update the DOM.
- Server-Sent Events - SSE is text-only so you would have to base64 encode the images. Not very efficient but easier to implement than WebSockets as the client automatically handles reconnection.
See also: w3c/web-thing-protocol#119
Reactions are currently unavailable