'Overcome WebRTC blocking on some ISP's

I am trying to build a video calling app using webRTC and it is works fine most of the times on home networks. The moment I enter a secure network like a university or an office space, I start getting socket.io errors and black screen instead of the video feed

I tried changing the port my app uses (Tried: 8080, 80, 3001, 243) The same problem exists on all the ports

I installed a chrome extension which blocks webRTC and could reproduce the problem on my home network. What should I do to overcome this problem? is it webRTC or socket.io? Thanks for the help!

ps: I am a beginner in webRTC and trying by best to use it in a production environment



Solution 1:[1]

Private networks like universities or offices typically block non-standard ports (anything other than HTTP for ex.), but considering you've tried port 80, your problem is most likely with NAT.

WebRTC works fine on some NAT configurations, but in certain cases, the NAT is set up such that a client is assigned a public-facing address/port that works for outgoing connections but can't be used for incoming connections. So when a peer under this configuration messages another peer, the latter peer may be able to receive the former's stream, but not vice versa (because the former's NAT-translated address can't receive incoming connections).

The solution is to set up a TURN server (check out COTURN), ideally running on some generic port (i.e port 80 or 443). Also, keep in mind that some countries outright block some of these protocols - in which case you'll need to provide your clients with a VPN (or develop your own protocol).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 zeim839