Bun WebSockets
Bun support on Colyseus is still experimental. Please report any issues you may find.
Installation
Terminal
bun add @colyseus/bun-websockets
app.config.ts
import config from "@colyseus/tools";
import { BunWebSockets } from "@colyseus/bun-websockets"
export default config({
// ...
initializeTransport: function() {
return new BunWebSockets({
/* Bun.serve options */
});
},
//
// BunWebSockets comes with Express compatibility layer.
//
initializeExpress: (app) => {
// register routes
app.get("/hello", (req, res) => {
res.json({ hello: "world!" });
});
},
// ...
})