admin管理员组文章数量:1326338
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.
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./docs/#dataconnection-close
Share Improve this question edited Sep 11, 2014 at 22:59 FreeWall asked Sep 11, 2014 at 21:36 FreeWallFreeWall 1191 gold badge3 silver badges9 bronze badges 2- 2 Go ahead and post an answer to your own question. – Benjamin Trent Commented Sep 12, 2014 at 12:32
- Can you explain how to disconnect the peer connection. [peerjs./docs/#dataconnection-close] link is not found – Sakkeer A Commented Mar 6, 2019 at 8:01
1 Answer
Reset to default 5There is DataConnection.close()
function to close the connection between peers.
http://peerjs./docs/#dataconnection-close
本文标签: javascriptPeerJSManually close the connection between peersStack Overflow
版权声明:本文标题:javascript - PeerJS - Manually close the connection between peers - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742199970a2431743.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论