Ability to connect to raw TCP or UDP from a browser is a major security hole.
Due to that, WebSockets were created were handshake is handled by browser transparently from developer ensuring port scanning is not possible.
As well as to preserver origin-based security model of HTTP. Which we want for WebUDP as well.