examples/discord-bot/actor-heartbeat.nu re-authenticates with a fresh IDENTIFY on every reconnect; it never resumes.
op resume is defined but never called. The re-auth path unconditionally sends op identify whenever authing is empty; no branch chooses RESUME when a session exists.
- The gateway sequence
s is never tracked: initial has s: null and no branch ever writes $message.s back to state. So heartbeats go out as d: null, and there is no cursor to resume from.
resume_gateway_url is captured from READY but unused; the websocat service hardcodes wss://gateway.discord.gg (RESUME must dial resume_gateway_url).
- op 7 (Reconnect) is unhandled (falls through to
_).
Result: every disconnect triggers a full re-IDENTIFY (new session, s resets to 1), dropping any events buffered for resume and consuming IDENTIFY budget. Observed in practice as repeated fresh READYs, never a RESUMED.
To resume: track max s from op-0 dispatches, send op heartbeat $state.s, branch re-auth to op resume when session_id/resume_gateway_url are set (authing: "resume"), have the ws service dial resume_gateway_url, and handle op 7.
examples/discord-bot/actor-heartbeat.nure-authenticates with a fresh IDENTIFY on every reconnect; it never resumes.op resumeis defined but never called. The re-auth path unconditionally sendsop identifywheneverauthingis empty; no branch chooses RESUME when a session exists.sis never tracked:initialhass: nulland no branch ever writes$message.sback to state. So heartbeats go out asd: null, and there is no cursor to resume from.resume_gateway_urlis captured from READY but unused; the websocat service hardcodeswss://gateway.discord.gg(RESUME must dialresume_gateway_url)._).Result: every disconnect triggers a full re-IDENTIFY (new session,
sresets to 1), dropping any events buffered for resume and consuming IDENTIFY budget. Observed in practice as repeated fresh READYs, never a RESUMED.To resume: track max
sfrom op-0 dispatches, sendop heartbeat $state.s, branch re-auth toop resumewhensession_id/resume_gateway_urlare set (authing: "resume"), have the ws service dialresume_gateway_url, and handle op 7.