socketio / socket.io-p2p

MIT License
1.02k stars 180 forks source link

Messages are doubled when using WebRTC #37

Open Jiffer opened 7 years ago

Jiffer commented 7 years ago

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

bennytheshap commented 7 years ago

+1

NerveCoordinator commented 5 years ago

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 thisp2psocket.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.