Navigation

    Colyseus
    • Login
    • Search
    • Recent
    • Tags
    • Users
    1. Home
    2. holywyvern
    holywyvern

    holywyvern

    @holywyvern

    Chat Follow Unfollow
    0
    Reputation
    3
    Posts
    950
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Continue chat with holywyvern
      • Flag Profile
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    holywyvern Follow

    Posts made by holywyvern

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

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

    posted in Questions & Help •
    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
           this.server.disconnect(anotherClientId);
       }
    }
    ...
    

    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.

    posted in Questions & Help •
    Is there a way to use colyseus.js on a node environment in a non "hack" way ?

    For the moment I have found one can "hack" it using something like:

      const Storage = require("dom-storage");
      global.WebSocket = require("uws");
      global.window = global;
      global.localStorage = new Storage(null, { strict: true });
    

    But it has many problems, like populating the global namespace.
    If this is still not good enough, one may prefer to create colyseus.js/server and use that inside node. I don't believe it should be required a new package to make a node integration, mostly because a lot of the code should be the same.

    posted in Questions & Help •