Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript WebSockets with UDP?

People also ask

Can WebSockets use UDP?

Websockets do not run over UDP, so this is not possible with any library anywhere. If you wan to use UDP, you'll have to use some other protocol, on both ends.

Does WebSockets use TCP or UDP?

The WebSocket protocol is an independent TCP-based protocol.

Does javascript support UDP?

Because of Security Concern, JS doesn't allow UDP port communication from browser.

Does node js use UDP?

js websockets use UDP or TCP.


It sounds like what you're waiting for is WebRTC which is working it's way through the standards process. WebSockets, as other people have pointed out, run over TCP as a result of initiating with an HTTP Upgrade.


No, it's not possible to have UDP communication within JavaScript. Sorry.


Sounds like the question is meant for client-side UDP, but since I ended up here...

You can do UDP in JavaScript on the server using the node.js dgram package.


The WebSockets protocol is over TCP only as currently defined.

You could do UDP with Flash if you are willing to use a RTMFP (Real Time Messaging Flow Protocol) server.


If this question is still pending: I found a project called JNEXT and there is an example using UDP. The project itself seems to be paused but at least in Firefox it works (it doesn't work with Chrome and Opera). May be it is worth to look for it.