Add support for ping messages in server for determining latency

This commit is contained in:
Peter Stockings
2026-03-05 13:54:08 +11:00
parent dd00011b77
commit a301d1521b

View File

@@ -137,6 +137,10 @@ const server = Bun.serve<WSData>({
}
switch (msg.type) {
case "ping": {
ws.send(JSON.stringify({ type: "pong", timestamp: msg.timestamp }));
break;
}
case "create_room": {
const username = (msg.username || "").trim();
if (!username) {