-
-
Notifications
You must be signed in to change notification settings - Fork 13
Added support for the "retry" field. #26
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
Conversation
|
@boenrobot thanks for bringing this up 👍 As a starting point, I think you will find similar tests inside the Does this help to get started? |
8320e21 to
44138a8
Compare
|
Thanks. I have added a test modeled after the last ID test. |
clue
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@boenrobot Thanks for looking into this, love the direction!
Also great to see this already has 100% code coverage in its current form. I've briefly checked the specs and noticed we should probably also check for valid values. In particular, a non-integer value should be ignored as per https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation
Can you add some additional tests to cover this in MessageEventTest?
44138a8 to
620c550
Compare
|
Good catch. That scenario was broken. I've added a test with an invalid value (that initially failed; the retry timer was set to 0), added a check that would accept only ASCII digits as valid, and would cast the value to either int or float in case the message's value to int or float (if the retry value is beyond PHP_INT_MAX; Not very likely, I know, but still, the spec doesn't impose limits and React supports float timers, i.e. more than PHP_INT_MAX). |
620c550 to
5e2cc55
Compare
clue
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@boenrobot Thank you for looking into this and your high-quality changeset, keep it up! 👍
Fixes #7
While the existing tests do pass, I'm not entirely sure how to make tests for this retry field yet... Just wanted to share the implementation. Some guidance to making tests for this will be appreciated.