JavaScript WebSockets with UDP?

丶灬走出姿态 提交于 2019-11-27 09:49:13

问题


I'm writing a JavaScript Application that has to receive a huge amount of data from other users. It is not important if some of this data gets lost. Is there some way of using JavaScript WebSockets with UDP instead of TCP?


回答1:


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




回答2:


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.




回答3:


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.




回答4:


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.




回答5:


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.




回答6:


I think you can leverage Silverliht 4 technology. You can create a Silverlight 4 application to communicate with server and then enbamdded it to html page. Then your JavaScript can build TCP connections via Silverlight 4 application!




回答7:


You could write a WebSocket server to serve as proxy/bridge between TCP/UDP.




回答8:


You can use Autohotkey application, receiving UDP packets and showing Internet Explorer and, finally, sending the contents filling one html TEXTAREA and simulate clicking one run BUTTON that fires one event that process UDP data. I did it in my project XPlane Assistant.



来源:https://stackoverflow.com/questions/4657033/javascript-websockets-with-udp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!