-
Notifications
You must be signed in to change notification settings - Fork 8
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
Consider a fallback ID mechanism for SSE events #252
Comments
Some background:
Note that ISO 8601 timestamps are also used in the
I personally don't think we need to define a fallback, since this is just a recommendation and in practice developers can use whatever IDs they want. However, some options to address the feedback: Advantages:
Disadvantages:
2. Add a fallback which says that if the device doesn't have a real time clock, to use an incrementing integer instead of a timestamp. Advantages:
Disadvantages:
3. Change the recommendation to say "The Advantages:
Disadvantages:
4. Replace the current recommendation with two assertions: "The Advantages:
Disadvantages:
I actually think option 4 is quite neat, but option 1 would be a simpler change and it's at least easier to detect when the ID is a timestamp. At the end of the day, IDs just need to be unique strings. When resuming a connection an SSE client just tells the server which was the ID of the last event it received. Ideally the Web Thing keeps an ordered log of events so it knows where to start from once the connection is resumed. Including timestamp metadata in that ID is just a bonus, which makes me think we should therefore probably just go with option 1. |
@benfrancis I think we should separate the two requirements:
These are two different requirements and should be separated in different fields of event message. The https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md |
Separating timestamp and ID into two separate fields is very different to the original request at the top of this issue. The problem with doing that is that SSE does not natively have a separate field for timestamps in its payload format. That means that adding a timestamp field would require adding a wrapper object to the content of the data field, for metadata. That would either mean:
I think that would make for an SSE protocol binding which is far less clean, and having a separate timestamp field isn't worth it.
This again... |
Architecture call 3/8
PR #119 added an assertion which says it's recommended that the id field of events in SSE is a timestamp.
In the feedback on the PR it was suggested there might be a fallback mechanism for devices without a clock, such as an incrementing number.
The text was updated successfully, but these errors were encountered: