This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
WebSocket library #1
Comments
Thanks David! Well, actually I followed what Tom Christie recommended in this thread: encode/httpx#304 (comment) Since I trust him to know way better than me what is better, I didn't question the choice 😬 |
Thanks for the answer, that makes sense. |
@aaugustin Do you have a list of pros and cons about Asking here because it may give some insights... 🤷♂️ |
In terms of API, websockets does more for you:
In terms of performance, you should see a big difference in favor of websockets when dealing with large frames (like, 1MB) because this code in wsproto, even though it's reasonably optimized Python, is nowhere near as fast as that code in websockets. This is actually a big performance bottleneck of all pure Python implementations. I believe that websockets a bit more battle-tested as it predates wsproto by a few years — some super-edge-case bugs were ironed out over the years. You're welcome to have Opinions about websockets' regex-based HTTP implementation. Well, it's fast, I cannot remember having to fix embarrassing bugs, and OSS-Fuzz didn't find anything after running billions of test cases. So I guess it's a viable way implement the required subset of HTTP for a WebSocket handshake? Anyway, it doesn't matter here, as you're planning to use httpx for parsing HTTP messages. The documentation of websockets' Sans-I/O layer tells you the basics but isn't at the same level as the documentation of the rest of the library — because so few people will integrate the Sans-I/O layer that I can support them individually. It's probably more useful to check this PR: https://github.com/aaugustin/websockets/pull/1245/files (or the actual code in the library once I merge it). There may be other aspects in which wsproto is superior to websockets. I know where I put my efforts in websockets; I don't know where the wsproto crew invested! Beyond that, WebSocket is a relatively small protocol so you will likely find pretty much the same code. At some point, websockets had higher performance; then everyone adopted the same ideas and I'm not sure there's a |
Thanks @aaugustin 🙏 |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Hi @frankie567, interesting project!
Out of curiosity, why did you choose
wsproto
over websockets?The text was updated successfully, but these errors were encountered: