(ws, room)
| 47 | })().catch(console.error); |
| 48 | }, |
| 49 | onConnect(ws, room) { |
| 50 | console.log(room.env); |
| 51 | |
| 52 | console.log(process.env.WHATUP); |
| 53 | |
| 54 | console.log(SOME_GLOBAL); |
| 55 | // your business logic here |
| 56 | ws.addEventListener("message", (evt) => { |
| 57 | const connections = [...room.getConnections()]; |
| 58 | if (evt.data === "ping") { |
| 59 | ws.send(`pong:${connections.length}`); |
| 60 | } else if ((evt.data as string).startsWith("latency")) { |
| 61 | ws.send(evt.data); |
| 62 | } |
| 63 | }); |
| 64 | }, |
| 65 | |
| 66 | // onMessage(msg, conn, room) { |
| 67 | // if (msg === "ping") { |
nothing calls this directly
no test coverage detected