How to enable the monitor module while using uwebsockets-express? (Resolved)

I followed alternative-express-compatibility-layer to employ uWebSockets.js in my colyseus server. I wanted to enable the monitoring module by the following code snippet but failed:

const uwsTransport = new uWebSocketsTransport({});
const app = expressify(uwsTransport.app);

app.use(cors());
app.use(express.json());

const auth = basicAuth.default({
  users: {
    someuser: "somepassword",
  },
  challenge: true,
});
app.use(auth);

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

const gameServer = new Server({
  transport: new uWebSocketsTransport({
  }),
});

Hi!
Are you using the latest version of Colyseus?

@COCO Here is the dependencies:

  "dependencies": {
    "@colyseus/core": "^0.14.29",
    "@colyseus/monitor": "^0.14.22",
    "@colyseus/schema": "^1.0.34",
    "@colyseus/uwebsockets-transport": "^0.14.29",
    "uwebsockets-express": "^1.2.2",
    ...

@duong2179

Please try the latest one:
"@colyseus/uwebsockets-transport": "^0.15.0-preview.1"

@COCO Tried, but it made no difference, unfortunately. I think the problem comes from how / syntax that I put the auth and monitor() in use with the app instance.

@duong2179

About the usage of "basic auth":

import basicAuth from "express-basic-auth";

const basicAuthMiddleware = basicAuth({
    // list of users and passwords
    users: {
        "admin": "admin",
    },
    // sends WWW-Authenticate header, which will prompt the user to fill
    // credentials in
    challenge: true
});

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

I don't see ".default" in the document, maybe it's the problem.

@COCO My bad. I recreated the transport as pointed out by Endel here https://github.com/colyseus/uWebSockets-express/issues/19

@duong2179

Glad you point it out and the problem resolved.