peerjs-server icon indicating copy to clipboard operation
peerjs-server copied to clipboard

How to programmatically disconnect user

Open be-thomas opened this issue 4 years ago • 3 comments

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.
    }
});

be-thomas avatar Feb 08 '21 11:02 be-thomas

client.getSocket().close()

borapop avatar Feb 08 '22 01:02 borapop

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.

bosskabouter avatar Jun 10 '22 13:06 bosskabouter

you can pass it as query string (URL parameters)

thomasb00 avatar Jun 10 '22 15:06 thomasb00