Why is there no UDP connection through the browser even with HTML5?

why can't we have an udp connection between browser and server? Why is it possible to connect tcp (web socket), but not udp?

+7
javascript browser html5 udp websocket
source share
3 answers

HTML5 does not allow arbitrary TCP connections.

Instead, web sockets are a special new protocol built on TCP that provides bidirectional communication.

Similarly, WebRTC is a special new protocol built on UDP that provides peer-to-peer communication.

Allowing arbitrary socket connections will be a serious security concern.

+5
source share

You can access UDP using WebRTC, which is available in the latest versions of Chrome and Firefox. This allows you to make a direct connection between the browser and the browser without having to go through the server, by the way.

+1
source share

Once upon a time, http was a protocol designed to transport text and html, such as paper or magazine. This data must be complete and reliable, so http is based on TCP, not UDP.

Later, people wanted to display several media through a browser. Some applications, such as flash and windows media player, sneaked into the browser and launched the background as a plugin. They can play video with UDP, and the browser does not lose sight.

Currently, we want more, even with an index of stocks or chats, of those real-time scenarios that are not suitable for http. Finally, the web socket is imported.

You see, the browser does not need UDP because of historical reasons. These plugins may be video.

-one
source share

All Articles