Edit history

Gateway: A session can't be resumed after a 1000 close, but the docs say it can for 60 seconds has not been edited, so there are no earlier versions.

Current version | Original by ⦓⡷⠂NEONSY⠐⢾⦔
Show

Gateway: A session can't be resumed after a 1000 close, but the docs say it can for 60 seconds

Reproduction steps

  1. Connect to the gateway with a bot token, Identify and wait for READY. Note session_id, resume_gateway_url and the last sequence
  2. Close the connection with code 1000
  3. Wait 2 seconds, connect to resume_gateway_url and send Resume (opcode 6)
  4. For comparison, repeat with close code 4000 instead of 1000

Expected behaviour

The session can be resumed. The docs say a session can be resumed "for 60,000 ms after any close, including a network failure or a normal 1000 or 1001 close" (opcodes-and-close-codes.md:82)

Actual behaviour

After closing with 1000, Resume gets opcode 9 with d: false, so the session is gone. After closing with 4000, Resume works and gets RESUMED. Tested on wss://gateway.fluxer.com on 2026-11-03

Platform

API

Evidence

Why it happens, at commit 5f3fc0b1:
  • A client close with 1000 or 1001 exits the socket as client_closed (gateway_handler.erl:257)
  • The session stops right away on client_closed instead of waiting for a resume (session_monitor.erl:68)
  • Every other close keeps the session for the resume timeout
Suggested fix: Either update the docs to say a 1000 or 1001 close ends the session, or keep the session for the resume window like other closes