admin管理员组文章数量:1208155
I want to have two different computers open a static html page, and be able to communicate to each other via WebRTC over a local area network. There is no internet connection to the outside world in this scenario. One of the pcs would be able to enter the ip address of the other pc manually and connect to it using that hardcoded IP. Is an ICE server necessary? If so, does the server itself need internet access to the outside world?
I want to have two different computers open a static html page, and be able to communicate to each other via WebRTC over a local area network. There is no internet connection to the outside world in this scenario. One of the pcs would be able to enter the ip address of the other pc manually and connect to it using that hardcoded IP. Is an ICE server necessary? If so, does the server itself need internet access to the outside world?
Share Improve this question asked Aug 16, 2018 at 5:42 Oved DOved D 7,44211 gold badges50 silver badges73 bronze badges1 Answer
Reset to default 19You do not need ICE servers in this case. In general, you have the following ICE candidates normally:
- host (are generated by the client by binding to its locally assigned IP addresses and port)
- srflx (server reflex candidates are generated by using STUN)
- relay (relay candidates are generated by using TURN)
So without ICE servers you will have only host candidates generated which is enough in your case because both users are in the same local network.
Although WebRTC enables peer-to-peer communication, it still needs a server for signaling: to enable the exchange of media and network metadata to bootstrap a peer connection.
So the main problem here is that you need to exchange the “offer” and “answer” between endpoints somehow, so each party will have enough information about each other. Normally, some signaling protocol + public server is used for this purpose.
In your case, you have 3 choices:
- to setup a direct p2p WebSocket connection between 2 browsers. Not sure if it's possible. Looks like a browser can only connect to other endpoint, not to listen.
- manually copy\past the 'offer' and 'answer' SDP, which is not good as well I think
- have some 3rd computer with some signaling server installed, so others peers will use it to exchange the 'offer' and 'answer' between each other
本文标签: javascriptHow can you do WebRTC over a local network with no internet connectionStack Overflow
版权声明:本文标题:javascript - How can you do WebRTC over a local network with no internet connection? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738762917a2111068.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论