five-on-it / apps/server/src/fleet-client
apps/server/src/fleet-client
A game server of the fleet tells the platform it is there (TECHNICAL_SPECS §11, the servers' wave): every FLEET.everyMs it posts a heartbeat (@foi/protocol's FleetHeartbeat: who it is, where players and the API reach it, its version, how full and how busy it is, its rooms, whether it drains) to the registry's /fleet/heartbeat with the fleet's secret. The registry forgets a server it has not heard from for 30 s; a draining server says so at once (FleetClient.beat).
FOI_FLEET_URL (the API's internal address), FOI_FLEET_SECRET, FOI_SERVER_ID, FOI_PUBLIC_URL and FOI_INTERNAL_URL turn it on (index.ts; {port} in the last three is the process's port, so one .env serves every process of a host).