Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server-Sent Events (SSE) Binding Template #361

Open
benfrancis opened this issue Apr 30, 2024 · 0 comments
Open

Server-Sent Events (SSE) Binding Template #361

benfrancis opened this issue Apr 30, 2024 · 0 comments
Labels
Has Use Case Potential The use case can be extracted and explained Selected for Use Case

Comments

@benfrancis
Copy link
Member

benfrancis commented Apr 30, 2024

Coming from discussions about Profiles 1.0, I would like to propose a binding template for Server-Sent Events (SSE), either as part of the HTTP Binding Template or a separate document.

Protocol Binding Template

For 1.x the key thing I think needs specifying is a default HTTP method for the subscribeevent and observeproperty operations when subprotocol is set to sse:

op value Default Binding
subscribeevent "htv:methodName": "GET"
observeproperty "htv:methodName": "GET"

(See also: #330).

Note that unsubscribing/unobserving in SSE just involves dropping the HTTP connection, so a note could be added to that effect.

It might also be a good idea to explicitly say that the default content-type when subprotocol is set to sse should be text/event-stream.

Payload Binding Template

Beyond that, I also think we need a payload binding for the text/event-stream content type which as a minimum says:

  • For events the event field should map onto the name of the event and the data field should map onto the event payload, serialised in JSON by default, and conforming to the event data schema
  • For properties the event field should map onto the name of the property and the data field should map onto the property reading, serialised in JSON by default, conforming to the property data schema

(See also: #347 regarding how to override the default nested content type).

I'm not sure whether both the protocol binding and payload binding should be specified in the same document, or separate documents.

WoT 2.0

For WoT 2.0, I hope this binding template can be expanded into a "Server-Sent Events Protocol Binding" document which replaces (through defaults) the whole of the protocol binding for the current HTTP SSE Profile.

If observeable action operations are added to the Thing Description specification in the future, this could also be covered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Has Use Case Potential The use case can be extracted and explained Selected for Use Case
Projects
None yet
Development

No branches or pull requests

2 participants