Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Nice. JSON over UDP is convenient, but has some drawbacks. But first your questions:

The answer to a) depends: If the payload is larger than can fit in a single datagram (the exact number can vary a bit) it has to be split. Each packet has some chance of loss. If it has to arrive, it has to be acknowledged and if split reassembled. So not bigger packets, but more of them.

For b) use WireGuard encryption. Not necessarily the VPN, just the handshake and transport protection. It’s very well aligned with UDP and lightweight enough to work on battery powered devices. I’ve added WireGuard termination to UDP Gateway specifically for this requirement.

Why am I not a fan of JSON over UDP? Extra serialization, extra size, extra constraints. None of those are huge deals, but I prefer something like MessagePack or CBOR for compact message sizes.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: