0

I developed a video chatting application using simple peer and socket.io . But when I tried hosting the application the peers could not be connected because of the firewall issue . I am aware that STUN and TURN servers are to be used for this purpose . Is it possible to connect to those servers using simple peer ? If so how? Any explanation or reference articles will be helpful

Padma govind
  • 31
  • 2
  • 4

2 Answers2

3

You can add the iceServer configuration like in original webrtc in the simple-peer config like so:

{
  initiator: false,
  config: { iceServers: [{ urls: 'stun:stun.l.google.com:19302' }, { urls: 'stun:global.stun.twilio.com:3478?transport=udp' }] },
}

You can add stun servers and/or turn servers.

Dirk V
  • 1,373
  • 12
  • 24
1

If you read the source code of the simple-peer npm package you will realize that it currently uses

URLs: [
  'stun:stun.l.google.com:19302',
  'stun:global.stun.twilio.com:3478'
]

for its public IP discovery needs.

Your app fails to work in case of firewall because just stun server is insufficient in case of firewall.

Besides a STUN server, you need a TURN server is this case.

TURN is the fallback is case STUN fails to deliver.

Mohit Gupta
  • 73
  • 1
  • 9