PeerJS - Manually close the connection between peers
I am using PeerJS for my P2P (multiplayer) application. Everything is fine (peer-to-peer connection, data sending), but I can't figure out how to manually close the peer-to-peer connection .
The docs have the functions "Close server connection" or "Close server connection and end all existing connections" ( peer.disconnect()
, peer.destroy()
), but I just want to " end existing connections " and not "close server connection".
I know I can only handle connections in an array and only send / receive data to peers with some status (like "connected" or "disconnected"), but other peers can send me data to overload forexample (hackers> ddos ββ.. .), so basically I want to be able to give something like BAN.
Any ideas (sorry for the bad english)?
DECIDE:
I must be really blind. There is a function to close the connection between peers DataConnection.close()
.
source to share