feat(gateway): log full watch Networking state transitions

Add watch-state N->M log on every djs/voice Networking stateChange (with
hasUdp flag) so the stream-watch connection's exact progression is visible:
OpeningWs(0)->Identifying(1)->UdpHandshaking(2)->SelectingProtocol(3)->
Ready(4). Pins down where the DAVE flow stalls instead of guessing from the
absence of logs. Pairs with debug:true + watch-djs-debug.
This commit is contained in:
asepharyana
2026-08-31 15:36:05 +07:00
parent b3e350d40f
commit 4534b7a17d
@@ -271,9 +271,14 @@ function connectWatch(
handleUdpMessage(watchKey, netAny, uidProps, msg);
};
net.on("stateChange", (newState: unknown) => {
net.on("stateChange", (newState, oldState) => {
const s = newState as { code?: number };
const code = s?.code;
const oldCode = (oldState as { code?: number })?.code;
logger.info(
{ userId: uid, code, oldCode, hasUdp: !!netAny.state.udp },
`watch-state ${oldCode}->${code}`,
);
if (code === 4 /* Ready */) {
const udp = netAny.state.udp;
if (udp) {