How to connect colyseus monitor In java script

22 Aug 2018, 06:38

app.use("/colyseus", monitor(gameServer));

cant use this

22 Aug 2018, 10:40

no sure what you mean under "connect in java script"
but to see monitor you need open in your browser: http://localhost:3553/colyseus/

22 Aug 2018, 15:48

@hardik_sl do you get any errors? You should be able to see the monitor when accessing the URL @AnubisCode mentioned, as you can see in the colyseus-examples project. (https://github.com/gamestdio/colyseus-examples)

4 Sept 2018, 09:56

@anubiscode i mean that if i use typescript then i can use this code to attach monitor ->
app.use("/colyseus", monitor(gameServer));

but if i use java script that will not work so any other way to attach monitor to game server??

4 Sept 2018, 11:47

Hi @hardik_sl, it should be the same in JavaScript, can you provide your source code that isn’t working? Cheers

4 Sept 2018, 12:17

@endel here the code

const http = require("http");
const express = require("express");
const monitor = require("@colyseus/monitor");
const colyseus = require("colyseus");
const GameRoom = require('./game_room');

const PORT = process.env.PORT || 3553;

const app = new express();
const gameServer = new colyseus.Server({
server: http.createServer(app)
});

// Register GameRoom as "table"
gameServer.register("table", GameRoom);

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

//colyseus game server monitor panel
app.use("/colyseus", monitor(gameServer));

// Listen on specified PORT number
gameServer.listen(PORT);

console.log("Running on ws://localhost:" + PORT);

4 Sept 2018, 16:43

@hardik_sl I see, here's what you should do differently:

const Monitor = require("@colyseus/monitor");

//colyseus game server monitor panel
app.use("/colyseus", Monitor.monitor(gameServer));

Hope this helps! Cheers

5 Sept 2018, 05:57

@endel Yay !! thats work Thanks.