Skip to content

feat: decide whether disconnect(true) closes every namespace #236

Closed

Description

@electrohyun

Problem

Smocket accepts the close argument of server-side socket.disconnect(close?) but intentionally ignores it in the implementation because there is no transport. That leaves an observable namespace-lifecycle question unresolved.

In a Socket.IO 4.8.3 probe, socket.disconnect(true) closed the other namespace sockets that shared the same underlying Manager, while socket.disconnect(false) disconnected only the current namespace socket. Smocket creates paired namespace sockets without an explicit shared connection object, so reproducing that result requires a project decision rather than a local return-value fix.

Before v1, decide whether Smocket should model the observable connection-wide teardown with an in-memory Manager stand-in, or document the lack of cross-namespace closing as a deliberate divergence. Do not describe this as a transport implementation or claim compatibility from accepting the boolean parameter alone.

Proposed API

const root = connect('http://localhost:3000');
const admin = connect('http://localhost:3000/admin');

const rootServerSocket = await io.nextConnection('/');
await io.nextConnection('/admin');

rootServerSocket.disconnect(true);

// Decision required:
// should both `root` and `admin` observe namespace teardown because they
// belong to the same logical connection, even though Smocket has no transport?

If connection-wide teardown is selected, define how independently created Smocket clients are associated with one logical Manager and pin the observable client/server event order and reasons. If it is not selected, record the boundary in an ADR and docs/differences.md.

Socket.IO behavior

Socket.IO 4.8.3 was observed to close every namespace socket sharing the Manager when the server calls socket.disconnect(true). Exact event ordering, reasons, callback timing, 4.7 behavior, and whether any client options change the grouping remain to be verified before implementation.

The decision concerns observable namespace lifecycle only. It must not introduce a real transport, transport fallback, heartbeat, automatic reconnection, Redis multi-server behavior, or binary encoding.

Scope check

  • This is not reconnection, transport fallback, heartbeat, Redis multi-server, or binary encoding

Activity

  1. added this to the v1.0.0 milestone on Aug 12, 2026
  2. added
    enhancement
    on Aug 12, 2026
  3. added
    fidelity
    needs decision
    on Aug 12, 2026
  4. self-assigned this
    on Aug 12, 2026
  5. moved this from Backlog to In progress in smocketon Aug 12, 2026
  6. moved this from In progress to Done in smocketon Aug 12, 2026
  7. modified the milestones: v1.0.0, v0.5.0 on Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementfidelityneeds decision

Type

No type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions