javascript - How to establish peer connection in web app using coturn (stun/turn) server -


i'm building web app cam broadcasting. i'm using django web app , coturn (stun/turn) signalling server. goal webrtc.

i don't know how connect peer signalling server in order reachable other peer. need know how stablish "peerconnection". in web application, have need (i think): user.id, shared secret, signalling server ip , port, ... don't know how mix in html js scripts connect coturn server.

i've read coturn server docs , searched examples can't find examples part.

can show me example?

i think bit confused, coturn not signalling server, turn/ stun server.

signalling server though exchange sdp, ice candidates , other data between peers before direct peer peer connection, coturn not that.

i cannot explain bits, gist stun used providing public ip of peer, , turn used proxy point transmitting , receving data peer when cannot directly accessed, , in cases require stun server. time involved in webrtc application when create peerconnection object, pass stun/turn server details in config object, example:

let pc = new rtcpeerconnection({   "iceservers": [     {"urls": "stun:example.com"},  // stun server address     {"urls": "turn:example.com", "credential": "test", "username": "test"}  // turn server address   ]  });  

Comments