Skip to content

Allow reconnection after terminate() via bind() - #10

Merged
bensie merged 1 commit into
mainfrom
bensie/test-bind-after-terminate
Mar 13, 2026
Merged

Allow reconnection after terminate() via bind()#10
bensie merged 1 commit into
mainfrom
bensie/test-bind-after-terminate

Conversation

@bensie

@bensie bensie commented Mar 13, 2026

Copy link
Copy Markdown
Member

Summary

When terminate() is called, the client closes its connection and clears all bindings. The JSDoc contract states that "reconnecting with this instance will require re-binding to client events." This PR fulfills that contract by allowing bind() calls with channels to establish a new connection after termination.

Changes

  • Added #terminated flag to track when the client has been explicitly terminated
  • In bind() with a channel, if terminated, create a new Connection to allow reconnection
  • Added test verifying that bind() after terminate() establishes a fresh connection with an open WebSocket

All 140 tests pass with 100% coverage maintained.

When terminate() is called, subsequent bind() calls with channels now
establish a new connection, fulfilling the documented contract that
"reconnecting with this instance will require re-binding to client events
and re-subscribing to channel events".
@bensie
bensie merged commit 981bb09 into main Mar 13, 2026
1 check passed
@bensie
bensie deleted the bensie/test-bind-after-terminate branch March 13, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant