How to talk to UDP sockets with HTML5?

Yes, the answer is still 'no'. Websockets are TCP based. Note that a WebSocket is not a plain TCP connection, there is HTTP negotiation and a framing protocol in place. So you also cannot create a plain TCP connection in Javascript.

WebRTC is based on UDP, it may cover your use cases: http://www.html5rocks.com/en/tutorials/webrtc/datachannels/


Chrome now seems to have something: https://developer.chrome.com/apps/sockets_udp


It looks like UDP for web is still an active area of development and potential standards creation. Posting this answer to record some new info current as of May 2020.

The following whitepaper has outlined a potential path forward that satisfies the security needs for an "unreliable-unordered" protocol: https://gafferongames.com/post/why_cant_i_send_udp_packets_from_a_browser/

There are extensions to desktop Chrome and desktop Firefox that are in active development. https://github.com/RedpointGames/netcode.io-browser The way mobile browsers are designed prevents this kind of modification from being added at present (good security reasons again) but could be added down the road.