socketio/socket.io-p2p

Messages are doubled when using WebRTC

Jiffer opened this issue · 2 comments

When "private" connection is established messages on the receive end are printed twice (the on 'peer-msg' function is called twice).
Is it possible the socket it still open and it is sending now over both despite this line in goPrivate()? :
p2psocket.usesockets = false

I am also getting this issue.

As a bandaid solution, can check the time between the last message and only display it iff the difference is more than 10 milliseconds.

It is strange because as far as I can tell the message is only emitted once, and doesn't go through the server. But this p2psocket.on('peer-msg', function (data) {} still fires twice. Couldn't figure out why.

Should also be noted I'm using bundle.js instead of index.js. There is a lot more code in bundle.js, so something in there might make a difference? Haven't tried index.js to see.