How to get rooms count and clients count that connect to server

Hi!
I want to get the number of rooms that are created on the server, how to get that number?
Thank so much!

Hi @takaaptech,

Here's what we have at the moment: https://discuss.colyseus.io/topic/24/how-to-access-to-main-from-room

(The issue you created on 2016 is still laying around #10)

Hi @endel !
Sorry I just a noob in js. From Server code in unity example, maybe i am using ClusterServer? How to know when we using Server or ClusterServer?

const cluster = require("cluster");
const express = require("express");

const ClusterServer = require("colyseus").ClusterServer;
const GameRoom = require('./game_room');

const PORT = process.env.PORT || 9000;
const gameServer = new ClusterServer();

// Register GameRoom as "game"
gameServer.register("game", GameRoom, {
maxClients: 2
});

if (cluster.isMaster) {
gameServer.listen(PORT);
gameServer.fork();

} else {
let app = new express();

app.get("/something", function (req, res) {
    console.log("something!", process.pid);
    res.send("Hey!");
});

// Create HTTP Server
gameServer.attach({ server: app });

}

console.log("Listening on " + PORT);

In that case, can I have a static count in Room so that each time Room Create, the count variable will increment?
Thanks

@takaaptech in the code you shown here you're using ClusterServer.

You can see the differences between Server and ClusterServer here: http://colyseus.io/docs/concept-worker-processes/

@ahtashamabbasse this section was removed, and ClusterServer has been deprecated. The best way we have for scaling currently is: https://github.com/colyseus/proxy

@endel thanks, we're done with it server scalability. Next step is redis.