From 9309c4bb47e30bbd3b538cf0648d6a01b5b0bde0 Mon Sep 17 00:00:00 2001 From: Rutger Clarke Date: Fri, 8 May 2026 20:29:57 +0100 Subject: [PATCH] feat(wilbur): add /health endpoint for load balancer routing Returns 200 when no player is connected, 503 when one is. Allows an Azure load balancer health probe to remove busy servers from the pool. --- SignallingWebServer/src/index.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/SignallingWebServer/src/index.ts b/SignallingWebServer/src/index.ts index 24cc8029..54284aad 100644 --- a/SignallingWebServer/src/index.ts +++ b/SignallingWebServer/src/index.ts @@ -1,4 +1,4 @@ -// Copyright Epic Games, Inc. All Rights Reserved. + import express from 'express'; import fs from 'fs'; import path from 'path'; @@ -328,6 +328,14 @@ if (shouldServerStart) { const signallingServer = new SignallingServer(serverOpts); +app.get('/health', (_req: express.Request, res: express.Response) => { + if (signallingServer.playerRegistry.count() > 0) { + res.sendStatus(503); + } else { + res.sendStatus(200); + } +}); + if (options.stdin) { initInputHandler(options, signallingServer); } @@ -351,3 +359,5 @@ if (options.rest_api) { } }).catch((err: unknown) => Logger.error(`REST API initialization failed: ${String(err)}`)); } + +