-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Replace socket.io-client #99
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
source/simple_socketio.ts
Outdated
args: [eventData], | ||
}; | ||
const dataString = eventData ? `:::${JSON.stringify(payload)}` : ""; | ||
this.ws?.send(`${PACKET_TYPES.event}${dataString}`); |
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.
it feels a bit wrong to do nothing if the ws isn't initialized. what did the previous client do?
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.
Don't think it was handled, the event_hub code does unsent event queueing. But I can investigate
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.
I've added a simple queue
I think I've fixed the reconnect behavior now, but didn't have time to properly test it. I'll also have to look at the code again later to see if it needs to be cleaned up. |
That's awesome stuff! I'll throw an additional review at it ASAP. |
LGTM! 😍 |
test/event_hub.test.js
Outdated
@@ -0,0 +1,32 @@ | |||
import { EventHub } from "../source/event_hub"; |
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.
Missing Copyright text
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.
Only one minor comment.
@@ -247,7 +237,7 @@ export class EventHub { | |||
* | |||
* If timeout is non-zero, the promise will be rejected if the event is not | |||
* sent before the timeout is reached. Should be specified as seconds and | |||
* will default to 10. | |||
* will default to 30. |
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.
Isn't this a breaking change?
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.
It was simply my noticing that the comment was incorrect.
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.
Ah okay. All good then!
"vite": "^4.2.2", | ||
"vite-plugin-dts": "^2.3.0", | ||
"vitest": "^0.30.1", | ||
"ws": "^8.13.0" |
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.
please remove unrelated dependency upgrades and make them in a separate PR
68c2591
to
c4f2e24
Compare
c4f2e24
to
a7834e5
Compare
Loving the progress so far! We're cheering for you in my team. Keep up the good work! ❤️ |
Yaaaay! |
Changes
Removes the old socket.io client and writes a new implementation using the same communication protocol. Re-implements the parts that we were using, and scraps the rest. None of the removed parts were documented, but it was parts that might have been found by people implementing the API, so it will be released as a part of the V2 release with other breaking changes.
Resolves #90
Test
Make sure the code looks good and the test cases seem to cover everything we need. Functionality can be tested in the application by yarn linking.