TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

WebSockets in curl

68 pointsby beshrkayaliover 2 years ago

3 comments

jraphover 2 years ago
I wanted to add WebSocket support in a node.js backend for a game I develop. This project has zero dependency outside node.js itself and I was reluctant to add any dependency for this, so I implemented WebSockets myself, with the help of a few example code and documentation from MDN. It does not handle the edge cases (that I don&#x27;t need), but it&#x27;s quite straightforward and I&#x27;m far from having Daniel&#x27;s expertise in this kind of stuff.<p>I trust him to implement WebSockets correctly, it&#x27;s way easier than most things he probably had to handle in curl.<p>It&#x27;s good he went for a solution that does not bloat curl.<p>Good to see this feature in Curl too. libcurl is very nice, things are designed in a straightforward way and it&#x27;s flexible, it&#x27;s a library done with taste, and the curl program is also very helpful and being able to debug websocket related stuff with it might be very handy.<p>About:<p>&gt; [libwebsockets] seems (too) tightly integrated with event libraries<p>I too often was slowed down by this kind of stuff when wanting to use anything on top of glib, like dbus for instance. These things want your program to be written in a certain way, rather than your program being able to call the library as it sees fit. In particular, you need to bent to the glib&#x27;s event loop, and good luck if your program does not quite work like this. There are ways, but there are not very well documented.
评论 #32782693 未加载
matt-attackover 2 years ago
Will this get exposed in the command line tool at some point? Not sure how that would work exactly.
评论 #32780467 未加载
评论 #32779300 未加载
评论 #32779312 未加载
moralestapiaover 2 years ago
&gt;The plan is to make curl do websockets similar to telnet&#x2F;nc.<p>I&#x27;ve been looking at something like this for ages. Thanks, Daniel!
评论 #32780659 未加载