socketio / socket.io-p2p

MIT License
1.02k stars 180 forks source link

Long delay before "Go private" button is enabled #55

Open draeder opened 5 years ago

draeder commented 5 years ago

Running this on localhost in two browser tabs. The "Go private" button does not enable in a timely fashion, sometimes taking up to a minute or more.

AdamSEY commented 4 years ago

That was just an example, you can enable that by yourself as follows:

const p2p = new P2P(socket);

setInterval(function(){ if (p2p.usePeerConnection === true){ // now the connection is established and ready }else{ // the connection is not ready yet }

}, 1000);

twofingerrightclick commented 3 years ago

For future readers: Remove the "trickle" parameter from the constructor in the chat example. That is what is done in the example above -> By only passing the socket the SocketIOp2p constructor, the default params are 5 clients, and autoUpgrade: true. So as soon as clients can connect to eachother they are "upgraded" to webRTC. I am not sure what the trickle parameter is... could find the documentation yet