peerjs-server
peerjs-server copied to clipboard
How to programmatically disconnect user
I want to be able to programmatically disconnect user if the client.id and client.token does seems fishy (PeerServer).
How would I go about doing that inside the connection handler -
peerServer.on('connection', (client) => {
if(is_fishy(client)) {
// disconnected it.
}
});
client.getSocket().close()
I would like to connect with a signature and let the server validate it against the id. I cannot find a way to pass this signature in the connection options so the server would be able to find it and tell if something is fishy..
EDIT. I didn't notice I could simply pass it in the 'token' property of the PeerJSOption.
you can pass it as query string (URL parameters)