How to use the colyseus.matchMaker.remoteRoomCall function in colyseus

To help you get started, we’ve selected a few colyseus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github colyseus / colyseus-monitor / src / api.ts View on Github external
api.get("/room", async (req: express.Request, res: express.Response) => {
        const roomId = req.query.roomId;
        try {
            const [_, inspectData] = await matchMaker.remoteRoomCall(roomId, "getInspectData");
            res.json(inspectData);
        } catch (e) {
            const message = UNAVAILABLE_ROOM_ERROR.replace("$roomId", roomId);
            console.error(message);
            res.status(500);
            res.json({ message });
        }
    });
github colyseus / colyseus-monitor / src / api.ts View on Github external
api.get("/room/call", async (req: express.Request, res: express.Response) => {
        const roomId = req.query.roomId;
        const method = req.query.method;
        const args = JSON.parse(req.query.args);

        try {
            const [_, data] = await matchMaker.remoteRoomCall(roomId, method, args);
            res.json(data);
        } catch (e) {
            const message = UNAVAILABLE_ROOM_ERROR.replace("$roomId", roomId);
            console.error(message);
            res.status(500);
            res.json({ message });
        }
    });