GitHub Documentation

Is there a way to disconnect a client by id from the server?

  • I want to know if is there a way to do something like the following:

    const server = new colyseus.Server({ ... });
    // Somewhere on a room:
    async onJoin(client) {
       if (someLogin) {
            // This disconnects a client based on id

    I would like such a feature, to be able to make a client only join a single room at a time, for example. Or if an account is logged in two computers, disconnect the older connection.

  • ...
    let playerList=new Map();//store player client info
    async onAuth(Client client,options){
        //if already joined
              //disconnect old clients
                if( oldClient.discontent();

  • This won't work in a @colyseus/proxy so it's not really a good solution.


© 2021 Lucid Sight, Inc