socketio / socket.io-protocol

Socket.IO Protocol specification
https://socket.io
506 stars 62 forks source link

fix: `waitFor` message latency causing missed packets #33

Open Totodore opened 10 months ago

Totodore commented 10 months ago

This PR fix issue #32. The proposed solution is to extend the ws WebSocket instance to add an async iterator working with the utility function createWebSocketStream coming from the ws library.

It has a minimal impact on the test suite codebase.

darrachequesne commented 10 months ago

Hi! Thanks for the pull request :+1:

I think it could also be fixed with a buffer, something like this: https://github.com/socketio/socket.io-protocol/commit/49fe300a835d2f90cbc2c058c9ad4cc501c12f43

What do you think?

Totodore commented 10 months ago

Your solution also work, it has the advantage that it is also working on the browser whereas mine only works for node.js (because it uses the official stream implementation).

This issue also need to be fixed on the engine.io test-suite (I already prepared all the patches with my solution). But if you prefer to do your's, no problem.