Problem
In _handleClosed, receivedEOSE is set to true when a relay sends a CLOSED message, even though no EOSE was actually received.
Why it matters
Per NIP-01:
- EOSE = "I've sent all stored events, subscription continues"
- CLOSED = "Subscription rejected or terminated" (auth-required, restricted, etc.)
These have different semantics. Code relying on receivedEOSE assumes the relay successfully processed the request, which is false when CLOSED is received.
Suggested fix
Add a separate flag (e.g., isTerminated or receivedClosed) instead of reusing receivedEOSE.
Problem
In
_handleClosed,receivedEOSEis set totruewhen a relay sends aCLOSEDmessage, even though no EOSE was actually received.Why it matters
Per NIP-01:
These have different semantics. Code relying on
receivedEOSEassumes the relay successfully processed the request, which is false when CLOSED is received.Suggested fix
Add a separate flag (e.g.,
isTerminatedorreceivedClosed) instead of reusingreceivedEOSE.