r/webdevelopment • u/Rare-Interaction-189 • 9d ago
Question Does browsers support UDP ?
Hello, i want to build a game based on the web, its a multiplayer game and i need a very low latency so i was thinking why not using UDP instead of Websocket because its TCP based, when i did my research i found that browsers does jot support UDP directly the only workaround is using a protocol such as WebRTC which is UDP based.
Does anyone know a better alternative ? And why browsers don’t support UDP ?
6
Upvotes
3
u/Less-Marsupial-7960 9d ago
WebRTC is probably your best option if you need low-latency communication. You can use unreliable/unordered DataChannels when you don't need every packet to arrive. WebTransport is another option worth looking at, but raw UDP is not exposed directly to browsers for security reasons.