feat: Send pings as comments by default #53
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Given 3 users who have made a comment on the ping events in #51 and #44 -- it might be best to send pings as comments by default, that way clients don't have to deal with them out-of-the box.
To achieve this, we can change the ping from an event data to an event comment as seen on this changeset,
However, the package does not seem to be encoding the events properly when a comment is included in the event. Examples,
ServerSentEvent(comment="a comment")
, then: a comment\r\n\r\n
: a comment\r\n
ServerSentEvent(data="some data", comment="a comment")
: a comment\r\ndata: some data\r\n\r\n
: a comment\r\n
If I understand the spec correctly (screenshot below) I think the expected data specified above is correct. Let me know otherwise!
![image](https://user-images.githubusercontent.com/13646646/235334723-dfb52c5f-9dab-4442-a5e6-54619532133c.png)
(from https://html.spec.whatwg.org/multipage/server-sent-events.html)
Testing
message
ordata