Add client and server connection-info windows

Sends raw getconnectioninfo/serverrequestconnectioninfo commands and
reads the reply out of tsclientlib's bookkeeping state (it already
tracks ping, packet loss, bytes/packets sent+received internally -
just needed to be requested and surfaced). Wired into the client
context menu (any client), the Selbst menu (self), and a new link in
the server info panel.

Uses send_with_result() so a permission-denied rejection surfaces as
a visible error instead of silently doing nothing; the dialogs also
fall back to a "no response" message after 6s in case the server
declines without any reply at all (observed against a real server
where a guest lacked b_virtualserver_connectioninfo_view).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
MoepchiandClaude Sonnet 5 committed 2026-08-04 22:42:23 +02:00
1 parent a300daedeb
commit 74f688aba8
7 files changed
+565 -3

No files matched your search

+34
View File
@@ -167,6 +167,40 @@ export class DemoSocket {
);
break;
}
case "getClientConnectionInfo": {
this.after(400, () =>
this.emit({
type: "clientConnectionInfo",
clientId: msg.clientId,
pingMs: 12.4,
connectedSecs: 217,
ip: msg.clientId === SELF_ID ? "127.0.0.1" : null,
packetsSent: 4213,
bytesSent: 512_340,
packetsReceived: 3987,
bytesReceived: 498_120,
packetLossPercent: 0,
})
);
break;
}
case "getServerConnectionInfo": {
this.after(400, () =>
this.emit({
type: "serverConnectionInfo",
pingMs: 8.1,
connectedSecs: 217,
packetLossPercent: 0,
packetsSentTotal: 21_004,
bytesSentTotal: 2_411_000,
packetsReceivedTotal: 19_872,
bytesReceivedTotal: 2_198_500,
bandwidthSentLastSecond: 4200,
bandwidthReceivedLastSecond: 3900,
})
);
break;
}
// "disconnect" is intentionally unhandled here: handleDisconnect() in
// App.tsx always calls socket.close() right after sending it, and
// close() already emits the "disconnected" event below.