Matchmaking is broken in v0.11.x if you set `options.server` but not `options.express`
See original GitHub issueI’ve been using Colyseus with Koa (https://github.com/koajs/koa), and it looks like that’s not possible anymore in Colyseus v0.11.x. Matchmaking is broken in v0.11.x if you set options.server but not options.express when constructing or attaching the Server.
const app = new Koa();
// configure app
const server = new Server();
// define room
const httpServer = app.listen(PORT);
gameServer.attach({
server: httpServer,
});
If it’s expected behaviour that this no longer works, then I think the Server constructor and attach() methods should throw an error if that configuration of ServerOptions is provided.
Additionally, if you pass empty options to the Server constructor, then later pass both options.server and options.express to attach(), the express routes never get set up (they are only called in the Server constructor).
const app = express();
// configure app
const server = new Server();
const httpServer = app.listen(PORT);
gameServer.attach({
server: httpServer,
express: app,
});
https://github.com/colyseus/colyseus/blob/f3fd41205c13873efda612d177af60e6e3345445/src/Server.ts#L64
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)

Top Related StackOverflow Question
can you try version
0.11.5out @rnd256?here’s a usage example with Koa: https://github.com/colyseus/colyseus/blob/master/usage/ServerKoa.ts
cheers!
Thanks @endel!! I still have more work to do to complete the migration, but matchmaking in
v0.11.6is working with Koa!