Since we cannot edit index.ts when deploying on Arena, how to deploy on Arena while it listening to wss:url and https for matchmaking API?
Here is my attemp:
import Arena from "@colyseus/arena";
import { monitor } from "@colyseus/monitor";
import { RelayRoom } from "./rooms/RelayRoom";
const { createServer } = require("https")
const { key, cert } = require("./ssl")()
import { WebSocketTransport } from "@colyseus/ws-transport"
const express = require("express")
import cors from "cors";
export default Arena({
getId: () => "Your Colyseus App",
initializeGameServer: (gameServer) => {
gameServer.define("gameroom", RelayRoom, {
maxClients: 100,
allowReconnectionTime: 0,
});
},
initializeExpress: (app) => {
/**
* Bind your custom express routes here:
*/
app.get("/", (req, res) => {
res.send("It's time to kick ass and chew bubblegum!");
});
/**
* Bind @colyseus/monitor
* It is recommended to protect this route with a password.
* Read more: https://docs.colyseus.io/tools/monitor/
*/
app.use("/colyseus", monitor());
},
beforeListen: () => {
/**
* Before before gameServer.listen() is called.
*/
},
initializeTransport: (options) => {
const app = express()
app.use(cors());
app.use(express.json())
// Prepare HTTPS server
const secureServer = createServer({ key, cert }, app)
console.log("secureServer created")
return new WebSocketTransport({
server: secureServer,
});
},
});