How to access to main from room

18 Jan 2018, 10:32

im doing lobby /Room/ and want to supply with other rooms data, how to access to other rooms and main.

18 Jan 2018, 15:13

Hi @Burjee-Bataa,

If you're using Server (single-process) you can take a look on how it's being done here: https://github.com/derwish-pro/colyseus-monitor?files=1

For ClusterServer it's more complicated. Each process have it's own instance of the MatchMaker class. The master node access a limited amount of data (via memshared, search for "memshared" on this file, you'll see what's available) just to be able to forward connections to the right process.

One suggestion when using ClusterServer is to keep track of your spawned rooms through the public events (https://github.com/gamestdio/colyseus/wiki/Room-handlers#listening-to-room-events-outside-the-room-scope), and consume the data as you need.

Cheers!

19 Jan 2018, 01:10

tnx, monitor nice one!

19 Jan 2018, 10:27

another question, how to leave room from client side?

19 Jan 2018, 10:59

@Burjee-Bataa this should do:

var room = client.join("room_name");
// ...
room.leave();