Navigation

  • Recent
  • Tags
  • Users
  • Search
  • Login
Colyseus
  • Login
  • Search
  • Recent
  • Tags
  • Users

Documentation GitHub

We're migrating to GitHub Discussions. This forum does not accept new registrations since April 6, 2023.
  1. Home
  2. holywyvern
holywyvern

holywyvern

@holywyvern

Chat Follow Unfollow
0
Reputation
3
Posts
1.4k
Profile views
0
Followers
0
Following
Joined 12 Apr 2018, 00:59 Last Online 28 Mar 2020, 19:10

  • 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 • 28 Mar 2020, 19:10
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 • 27 Mar 2020, 03:24
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 • 12 Apr 2018, 01:15

© 2023 Endel Dreyer