How to connect colyseus monitor In java script
-
app.use("/colyseus", monitor(gameServer));
cant use this
-
no sure what you mean under "connect in java script"
but to see monitor you need open in your browser: http://localhost:3553/colyseus/
-
@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)
-
@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??
-
Hi @hardik_sl, it should be the same in JavaScript, can you provide your source code that isn’t working? Cheers
-
@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);
-
@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
-
@endel Yay !! thats work Thanks.