I use PeerJS for my P2P application (a multiplayer game). Everything is great (connection between peers, sending data), but I can't figure out how to manually close the connection between peers.
In docs are functions to "Close the connection to the server" or "Close the connection to the server and terminate all existing connections" (peer.disconnect()
,peer.destroy()
), but I just want to "terminate existing connections", not to "close the connection to the server".
I know I can handle connections in array and sending/receiving data just for peers with some status (like "connected" or "disconnected"), but other peers can sending data to me for overloading forexample (hackers > ddos...), so basically I want to have opportunity to give something like BAN.
Any ideas (sorry for bad english)?
SOLVED:
I must be really blind. There is DataConnection.close()
function to close the connection between peers.
http://peerjs.com/docs/#dataconnection-close
There is DataConnection.close()
function to close the connection between peers.
http://peerjs.com/docs/#dataconnection-close
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With