4 ms·
> socket.io is probably one of the most unnecessary libraries on this planet. Websockets are already as simple as possible. Eh... While I agree that socket.io
by korkybuchek 1y ago
> socket.io is probably one of the most unnecessary libraries on this planet. Websockets are already as simple as possible.
Eh... While I agree that socket.io is one of those libraries you could probably "write" in an afternoon, and Websockets are simple, there are a couple of things that are kinda painful to rewrite time after time:
- keepalives to detect dead sockets
- reconnection logic with backoff
- ability to switch to long-polling for weird environments
- basic multiplexing/namespacing
- andoando 1y agoAnd automatic json parsing of messages
- Karrot_Kream 1y agoWebsockets already have keepalives. Everything but long polling is doable in a few hours and can probably be one-shotted by an LLM. For long-polling, you can just drop down to Fetch calls.
- sourcemap 1y agoThis is true. Just a few days ago I had Claude one-shot some WebSocket utilities for reconnect and message queueing. It took 2 minutes. I've written countless WebSocket wrappers in the past (similar aversion to socket.io as others in this thread). The one-shot output was perfect. Certainly better than my patience would've allowed. Maybe socket.io is doing something fancy on the server side, but for clients, it's absolutely overkill.
- korkybuchek 1y agoMaybe you could save that one-shotted code into a library of some sort...?