How to send a UDP Packet with Web RTC - Javascript?

后端 未结 2 947
盖世英雄少女心
盖世英雄少女心 2020-11-29 08:25

How do you send a UDP Packet using Web RTC?

相关标签:
2条回答
  • 2020-11-29 09:04

    You can't send a UDP packet directly with WebRTC. That would violate the basic security constraints required by the browser.

    You can send SRTP to an ICE-enabled host. That is probably not what you are looking for.

    If a browser permitted sending arbitrary UDP packets, then malicious applications could send packets to any host.

    This might not sound so bad, after all, hosts on the Internet need to be able to deal with that right? The problem is that some browsers are in protected environments where access to the network is restricted. Within those networks, some hosts are far less protected than a host on the public Internet might be. This would be OK, since access to the network is controlled.

    If it were possible for a browser to send arbitrary packets, a user on a browser in that environment could be convinced to send specifically crafted packets to one of these poorly protected hosts. Likely, that would result in the network operator banning the browser, which is something browser-makers want very much to avoid.

    WebRTC only sends certain types of UDP packet under specific conditions. If the host that you are interested in talking to understands ICE and is able to consume RTP with SRTP or SCTP over DTLS (unlikely methinks). Then perhaps you could force the browser to send something.

    0 讨论(0)
  • 2020-11-29 09:09

    You should check sipml5, http://code.google.com/p/sipml5/ get the code and look into the folder: sipml5/src/tinySIP/src/transports

    0 讨论(0)
提交回复
热议问题