简体   繁体   中英

Can JavaScript listen to UDP ports within a browser?

I currently have an application that I've made in Flutter and wish to make a web application. This app listens to UDP data, decodes the information and displays it on a screen.

I understand that browsers cannot send UDP data. I do not care about this, I am only interested in listening to the data.

Research:
I understand that sockets.io is TCP only, therefor won't work with my app.
Looking at webRTC, it seems a possibility as it supports both TCP and UDP: Does WebRTC use TCP or UDP?

Would I be able to do what I want to with webRTC? Or is there some other library which would let me do this, or is it impossible?

Note: This web app listens to a local IP address of the user's network.

Short answer : NO . Why ?

Because of security constrains like Distributed Denial of Service (DDOS) attacks, and that make it too vulnerable to make in JavaScript.

The closest technology available (that I know of) for client-side JS is WebRTC

With WebRTC you can use DataChannels over SRTP and ICE as a possible solution.

See Also:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM