Skip to content

LoopMonitor

Feeds the hub’s event-loop delay (hub.loopRecent, hub.loop), which its overload switch reads: a p99 over 30 ms in the last window sends bigger rooms at half rate and refuses new rooms until the loop catches up. createGameServer and createRemoteServer start one; a host app with its own server makes one next to its hub and calls stop() when it closes. windowMs (default 10 s): the span loopRecent covers; minuteMs (default 60 s): the span of hub.loop, shown in stats(). The timers are unref’d, so they never keep a process alive.

new LoopMonitor(hub, o?): LoopMonitor

Pick<RoomHub, "loop" | "loopRecent">

number

number

LoopMonitor

stop(): void

void