TL;DR Delivery cases compare smocket with real socket.io or real ws from the same test file, in separate report sections. The list is generated only when both test projects succeed. Mock-specific rules and repository tooling are listed separately.
Important
The real-library sections record cases that run against both targets. Mock-specific ws rules and repository tooling run only in the mock project. This report is not a percentage of either library's complete API and does not claim complete compatibility.
Socket.IO comparison files call setupServer() from
src/setup-server.ts, which resolves to a real socket.io
server or to smocket depending on SMOCKET_TARGET, and the two targets are the two
vitest projects pnpm test:real and pnpm test:mock run. The test body is the same
either way.
The ws comparison uses test/ws/setup-ws.ts to select real
ws or the internal ws runtime under the same two projects. Its Node-only fixtures
live outside the browser suite; virtual host and network-isolation checks run only
on the mock and are reported without a real-ws equivalence claim.
The real target is the oracle, and the order matters. A case is written against it first, so what the case asserts is socket.io's behaviour and not the mock's. Running the identical file against smocket then asks one question, whether the same assertion still holds. That is why a red mock target is read as a divergence located rather than a test that needs adjusting.
No case asserts non-receipt by waiting. A timeout only says an event had not arrived
yet, and it buys that weak claim with a slow suite. The cases send a later event to the
same socket instead and assert the ordering: once the marker has arrived, anything that
was supposed to precede it would already be there. The helpers are in
src/test-events.ts.
Both targets run on every push and pull request, across three operating systems, so the comparison is continuous rather than something last confirmed by hand. The single CI badge on the README goes red if either target does.
Every case below ran against socket.io 4.8.4 and socket.io-client 4.8.4 first and against smocket second, from the same test file, and passed on both. Each links to the test that pins it.
Pairing a client with its server socket, the id both sides see, and the first emit.
- both sides have a socket id once connected
- server connection state changes at the same lifecycle boundaries as socket.io
- a socket id is 20 characters of url-safe base64
- io.on('connection') fires with the connecting server socket
- io.on('connect') is a synonym for 'connection' on the server
- a client-to-server emit arrives
- a client-to-server ack comes back
- a server-to-client ack comes back
Join and leave, and which members an emit to a room reaches.
- joining a room receives emits for that room
- a client that has not joined does not receive emits for that room
- after leaving, a client no longer receives emits for that room
- a socket in several rooms receives the emits of each room
- every client in the same room receives (fan-out)
The broadcast variants and the sockets each one targets or excludes.
- socket.broadcast.emit goes to everyone except the sender
- io.except(room) goes to everyone not in that room
- to() with an array delivers to the union of the rooms
- chaining to() delivers to the union of the rooms
- the array union delivers only once even when a socket is in several rooms
- the chained union delivers only once even when a socket is in several rooms
- in() is an alias for to()
- socket.except(room) excludes both the sender and that room
- io.to(socketId) delivers only to that socket (its own id room)
- socket.rooms is server-only and reflects its own id and join/leave
- socket.to(room) excludes the sender even when the sender is a member of that room
- io.emit() delivers to everyone connected
Narrowing a broadcast further, and whether the order of the narrowings matters.
- io.to(room).except(id) sends to the room minus that socket
- the two orderings of to and except reach the same sockets
- chaining except twice excludes the union of both
- a chained call returns a new operator and leaves the original alone
- socket.to(room).except(id) keeps excluding the sender
- socket.broadcast.except(id) excludes the sender and that socket
- in() on the operator is an alias for to()
- io.of(nsp).to(room).except(id) narrows within that namespace
Fetching existing local server Sockets through canonical room, exclusion, sender, and namespace selection.
- io.fetchSockets returns the existing local sockets in connection order
- fetchSockets applies room union, deduplication, and exclusions
- a socket management operator excludes its sender and named rooms
- fetchSockets stays inside its namespace even when room names match
- dynamic parents keep Socket.IO fetchSockets boundaries
- lookup ignores timeout, volatile, and compression delivery modifiers
Joining and leaving rooms synchronously through canonical room, exclusion, sender, and namespace selection.
- io.socketsJoin synchronously joins every root Socket
- socketsJoin applies room union, deduplication, and exclusions
- socketsLeave snapshots the selected set before mutating its target room
- a Socket management operator excludes its sender from bulk membership
- bulk membership stays inside its namespace
- bulk membership ignores delivery modifiers
- dynamic parent bulk membership follows Socket.IO and does not reach children
Disconnecting selected namespace Sockets or their shared Manager groups through canonical management selection.
- io.disconnectSockets(false) synchronously closes every root Socket only
- disconnectSockets applies room union, exclusions, and snapshot selection
- a Socket management operator excludes its sender from bulk disconnect
- disconnectSockets(true) closes each selected Manager group exactly once
- disconnectSockets(true) cancels pending admission on a selected Manager
- bulk disconnect ignores delivery modifiers and stays namespace-local
- dynamic parent bulk disconnect follows Socket.IO and does not reach children
send, write, open, close, socket in, and compression chaining. Compression
packet effects stay outside the transport-free mock boundary.
- Server and Namespace send and write broadcast message and return their receiver
- a dynamic parent sends and writes directly while exposing a compress operator
- server and client Socket send aliases emit message once and return their socket
- a buffered client send observes outgoing before connect and named delivery
- server Socket in aliases to while preserving sender exclusion
- compress returns immutable broadcast operators and composes with narrowing
- broadcast compress preserves a pending acknowledgement timeout
- Socket compress stays fluent through timeout and volatile decorations
- client open and close delegate to the lifecycle and keep fluent identity
What a namespace isolates: connections, emits, rooms, and socket ids.
- io.of normalizes empty and bare static namespace names
- a registered static namespace admits the normalized connection name
- an unregistered static namespace is rejected without membership
- a client can retry after its static namespace is registered
- io.of(nsp).on('connection') fires only for connections on that namespace
- io.of(nsp).emit() goes only to clients in that namespace
- io.emit() on the default namespace does not reach other namespaces
- a room of the same name is separate per namespace
- a client attached to two namespaces has a different socket id per namespace
- socket.broadcast stays inside the namespace of the sender
- io.of registers its listener on a new namespace
- io.of registers its listener on an existing namespace
- io.of registers its listener on the root namespace
Parent admission, concrete child lifecycle, setup snapshots, and direct broadcasts. Narrowed operator construction is covered, while narrowed delivery remains unverified under 0029.
- emits new_namespace synchronously once for static namespaces but not root or parents
- admits RegExp children, caches them, and attaches manual children to the parent
- rejects dynamic namespace RegExp with g flags before admission
- rejects dynamic namespace RegExp with y flags before admission
- rejects dynamic namespace RegExp with gy flags before admission
- preserves stateless RegExp lastIndex when admitting and reading cached children
- uses admission order but the latest duplicate RegExp parent for manual attachment
- does not attach a manually created namespace to a function parent
- reuses one child for concurrent admission and supports the of listener overload
- tries function matchers in order with normalized names and auth until one allows
- invokes a dynamic namespace matcher after the client factory returns
- does not invoke a dynamic matcher for a connection cancelled after return
- rejects an unmatched dynamic namespace as Invalid namespace
- retries dynamic admission after an earlier matcher rejection
- dynamic admission reads the current client.auth on a manual retry
- creates a child before middleware and snapshots parent setup at creation
- copies the parent connect synonym to a concrete child
- ignores duplicate client connect calls while async dynamic admission is pending
- cancels dynamic admission while callback-form auth is unresolved
- cancels unresolved dynamic matching with shared Manager disconnect(true)
- continues parent matching after a cancelled parent rejects late
- reuses one child for concurrent async same-name admissions
- broadcasts directly across children while child rooms and lifecycle stay isolated
- exposes narrowed parent operators without selecting their delivery result
- keeps shared Manager teardown connection-wide across dynamic children
- uses one concrete child for nextConnection, lookup, and Manager grouping
- creates a RegExp child when nextConnection observes it before a client connects
- keeps new_namespace available as an ordinary Socket payload event
The trailing callback and emitWithAck, in both directions.
- multi-argument ack resolves with the first value
- the trailing callback receives the sender-side ack
- a client timeout callback preserves every acknowledgement argument
- a server timeout callback preserves every acknowledgement argument
- timeout emitWithAck keeps the first-value Promise policy in both directions
- calling ack twice runs the sender callback only once
- discards retained acks in both directions after the client disconnects
- discards retained acks in both directions after the server Socket disconnects
- discards retained acks in both directions during server close
- emitWithAck stays pending when the peer never acks
- server-to-client emitWithAck works without a timeout
- emitWithAck buffers while disconnected and settles after reconnect
Connection-owned teardown guards, broadcast partial responses, and direction-specific one-shot consumption when response encoding fails.
- drops a client-to-server ack invoked after the server Socket disconnects
- drops a server-to-client ack invoked after the client disconnects
- drops a server-to-client ack invoked after Server.close()
- keeps acknowledgements invoked before teardown in both directions
- times out a broadcast with only the connected recipient response
- consumes a client-generated ack when its first BigInt response cannot be encoded
- consumes a client-generated ack when its first circular value response cannot be encoded
- keeps a server-generated ack callable after a failed BigInt response
- keeps a server-generated ack callable after a failed circular value response
- does not collect a broadcast retry after a client BigInt response fails
- does not collect a broadcast retry after a client circular value response fails
JSON results, snapshot timing, invalid data, and reference isolation.
- client-to-server payloads use JSON results and snapshot at emit
- server-to-client payloads snapshot at emit and decode fresh values
- client-to-server ack requests and responses cross independent snapshots
- server-to-client ack requests and responses cross independent snapshots
- a buffered client payload stays live until outgoing observation and flush
- direct outgoing listeners mutate the live source before the snapshot
- broadcast snapshots once before outgoing listeners and decodes per recipient
- room ack broadcasts snapshot requests and responses per recipient
- toJSON and enumerable own properties determine decoded object results
- a plain toJSON result keeps an original binary property out of the packet
- a broadcast encodes even when its room has no recipients
- circular and BigInt payloads fail before delivery in both directions
- only a client timeout survives a payload encoding failure
- timeout and connected volatile wrappers use the same payload boundary
timeout(ms) on a single emit, and what a late ack does.
- the timeout callback receives (null, response) when the ack wins
- works server-to-client with the same success shape
- returns the same socket and consumes a direct timeout once, on both sides
- keeps a recipient timeout pending across plain and ack-collecting broadcasts
- the callback gets a single timeout Error when the peer never acks
- times out the same way server-to-client
- drops a late ack that arrives after the timeout already fired
- timeout().emitWithAck resolves with the response when the ack wins
- timeout().emitWithAck rejects with the timeout Error on expiry
- keeps a timed callback buffered until reconnect and settles it normally
- does not revive a timed callback that expired while buffered
- does not deliver emitWithAck after its buffered timeout expires
- server timeout().emitWithAck resolves and rejects with the same one-shot decoration
- times out volatile server emits in either modifier order without delivering them
- a callback-less timeout emit still delivers and arms no timer
- times out ordinary callback acknowledgements after connection failure
- times out volatile callback acknowledgements after connection failure
- rejects ordinary promise acknowledgements on timeout after connection failure
- rejects volatile promise acknowledgements on timeout after connection failure
- consumes a callback-less timeout after connection failure without timing out later acks
Collecting an ack from every recipient of a broadcast, and answering on expiry.
- collects every recipient ack and answers (null, responses)
- orders responses by ack arrival, not by join order
- answers (Error, partial responses) when a recipient never acks in time
- invokes the callback exactly once, dropping an ack that arrives after expiry
- answers (null, []) at once for a broadcast to a room with no recipients
- socket.broadcast.timeout(ms) collects from everyone except the sender
- a chained except drops that recipient from the collection, timeout set first
- a chained except drops that recipient from the collection, timeout set last
- socket.timeout(ms).to(room) collects from the room, timeout set first
- socket timeout transfers once to the to operator
- socket timeout transfers once to the except operator
- socket timeout transfers once to the broadcast operator
Awaiting every selected recipient, including timeout errors, snapshots, and wrapper composition.
- broadcast emitWithAck resolves responses in acknowledgement arrival order
- a disconnected recipient cannot finish a broadcast acknowledgement collection
- untimed broadcast acknowledgement collection keeps the timer race and resolves [] for nobody
- untimed broadcast acknowledgement collection times out when a recipient never acknowledges
- timed-out callback collection ignores late acknowledgements
- timed-out promise collection ignores late acknowledgements
- server, namespace, room, exclusion, and socket broadcast share Promise collection
- timeout-first and narrowing-first Promise broadcasts select the same responders
- Promise broadcast hides its collector ack and observes each selected socket once
- reserved Promise broadcasts reject without outgoing observation
- dynamic parent Promise acknowledgements resolve [] without reaching concrete children
- Promise broadcast snapshots one request and each acknowledgement response independently
io.use: admitting a connection, rejecting one, and the order two run in.
- invokes namespace middleware after the client factory returns
- does not invoke namespace middleware for a connection cancelled after return
- a pass-through middleware admits the connection and fires connection
- the middleware reads the connecting socket handshake
- next(err) makes the client observe connect_error with the error message
- the rejecting error's data passes through to the client
- connect_error exposes a JSON snapshot instead of the server Error
- a rejected connection cleans temporary membership and stays out of the roster
- a cancelled connection attempt cannot be admitted by a late middleware callback
- ignores duplicate connect calls while static namespace middleware is pending
- io.of(nsp).use() runs only for connections on that namespace
- two middlewares run in registration order
- an error in the first middleware short-circuits the second
- completes once per synchronous next call with one server Socket
- completes again when a retained next runs after the first connection
- ignores a retained next released while the server closes
- ignores a retained middleware error after the client disconnects
- reports a later middleware error after connection and removes the server Socket
Per-packet ordering, mutation, acknowledgements, rejection, and independent asynchronous continuation.
- registers per-socket middleware in order and returns the same socket
- runs incoming catch-alls before middleware and exposes packet mutation downstream
- keeps the acknowledgement callback in the mutable middleware packet
- snapshots middleware when each packet begins processing
- lets a later packet complete while earlier packet middleware is held
- short-circuits on next(error), emits that Error, and does not acknowledge
- does not dispatch a held packet after the socket disconnects
The handshake fields a mock can source, and how auth and query reach them.
- the connection handshake carries the fields a mock can source
- handshake.auth defaults to an empty object when the client passes none
- handshake.auth carries the client-supplied auth values
- handshake.auth is a JSON snapshot of the CONNECT packet
- handshake.query stringifies the client-supplied query values
- handshake.auth accepts a function form, resolved via its callback
- invokes callback-form auth after the client factory returns
- disconnect cancels a static connection while callback auth is unresolved
- a reconnect replays the client-supplied auth on the fresh socket
- a reconnect reads a replacement object from client.auth
- a reconnect re-evaluates the current callback from client.auth
The per-socket store, its isolation, and its lifetime.
- socket.data is an empty object at connection
- middleware writes to data and a connection handler reads it back
- each socket has its own data
- a reconnection gets a fresh, empty data rather than the previous socket store
What volatile delivers in steady state, and the one window where it drops.
- a volatile emit is delivered on a connected socket (server to client)
- a volatile emit is delivered on a connected socket (client to server)
- io.volatile.to(room) routes to the room like a normal broadcast in steady state
- socket.volatile.broadcast reaches everyone except the sender in steady state
- io.to(room).volatile and io.volatile.to(room) preserve the same target
- namespace narrowing and volatile preserve each other in either order
- socket.to(room).volatile and socket.volatile.to(room) keep sender exclusion
- socket.broadcast.volatile and socket.volatile.broadcast keep sender exclusion
- volatile stays immutable and survives to, in, except, and timeout in either order
- a volatile emit still carries an ack, which round-trips when delivered
- volatile emitWithAck delivers and fires outgoing catch-alls in both directions
- a volatile emit to a recipient still in the pre-connect window is dropped
- a volatile emit from a client still in the pre-connect window is dropped
- consumes volatile once when the same server socket reference is reused
- keeps a recipient volatile flag pending across an unrelated broadcast
- transfers a server volatile flag once to the to operator
- transfers a server volatile flag once to the except operator
- transfers a server volatile flag once to the broadcast operator
onAny / offAny on both sides, and the events they do not see.
- a server-side catch-all fires for every incoming event with the name and args
- a catch-all runs before the specific listener for the same event
- a catch-all does not fire for the reserved disconnect events
- offAny(listener) removes one catch-all, offAny() removes all
- the same catch-all registered twice fires once per registration
- offAny removes one occurrence of a doubly-registered catch-all
- a catch-all receives an ack callback as the last argument
- a client-side catch-all fires for a server emit
- a client catch-all runs before the specific listener for the same event
- a client catch-all does not fire for the reserved disconnect event
- client offAny(listener) removes one catch-all, offAny() removes all
- server prependAny listeners run newest-first before onAny listeners
- client prependAny listeners run newest-first before onAny listeners
- server listenersAny is live and offAny removes the first matching duplicate
- client listenersAny is live and offAny removes the first matching duplicate
- offAny replaces both sides backing arrays and detaches earlier lookups
- incoming catch-all dispatch snapshots listener mutations on both sides
- a client incoming catch-all receives the server ack callback
- empty listenersAny lookups are fresh and cannot install listeners on either side
- offAny on untouched sockets keeps empty lookups fresh and inert
- offAny detaches the old arrays and installs stable empty replacements
- incoming catch-all callbacks receive their owning socket on both sides
onAnyOutgoing / offAnyOutgoing, and where in the send path they fire.
- a server-side outgoing catch-all fires for a direct emit with the event name and args
- a client-side outgoing catch-all fires for a client emit
- a client timeout survives an outgoing catch-all throw and is then consumed once
- a connected volatile emit fires the outgoing catch-all, on both sides
- the outgoing catch-all runs before the peer receives the event
- io.emit fires the outgoing catch-all on every recipient socket
- a broadcast fires the outgoing catch-all on the reached socket, but not the sender
- the outgoing catch-all does not fire for the disconnect lifecycle
- the ack callback is stripped from the outgoing catch-all args, for emit and emitWithAck
- offAnyOutgoing(listener) removes one, offAnyOutgoing() removes all
- the client side carries offAnyOutgoing too
- server prependAnyOutgoing listeners run newest-first before onAnyOutgoing listeners
- client prependAnyOutgoing listeners run newest-first before onAnyOutgoing listeners
- server listenersAnyOutgoing is live and removes the first matching duplicate
- client listenersAnyOutgoing is live and removes the first matching duplicate
- offAnyOutgoing replaces both sides backing arrays and detaches earlier lookups
- outgoing catch-all dispatch snapshots listener mutations on both sides
- the client outgoing catch-all omits ack callbacks for emit and emitWithAck
- empty listenersAnyOutgoing lookups are fresh and cannot install listeners on either side
- offAnyOutgoing on untouched sockets keeps empty lookups fresh and inert
- offAnyOutgoing detaches the old arrays and installs stable empty replacements
- outgoing catch-all callbacks receive their owning socket on both sides
Which public emit names throw before delivery or outgoing observation.
- server emit surfaces reject the six reserved names and accept application events
- client emit surfaces reject the six reserved names and accept application events
- client wrappers reject reserved names while the connection is still pending
- rejected server emits reach neither the peer nor outgoing catch-alls
- rejected client emits reach neither the peer nor outgoing catch-alls
- a rejected client event retains its timeout for the next completed emit
- emitWithAck rejects reserved names without firing outgoing catch-alls
- connection and new_namespace remain ordinary public payload event names
off and removeAllListeners, including the places the two sides disagree.
- off removes only the named registration
- the same callback registered twice is called once per registration
- off removes one occurrence of a doubly-registered callback, leaving the rest
- removeAllListeners(event) clears every listener for that event only
- removeAllListeners() clears listeners for every event
- removeAllListeners() clears a disconnect handler, but the socket still tears down
- off and removeAllListeners are no-ops for unknown listeners or events
- catch-all removal is a no-op for an unknown listener
- a listener removed during its own dispatch still runs for that dispatch
- off removes a once registration by its original listener
- off removes a once registration on the client side too
- server off removes the last match, leaving the earlier once registration
- server off removes the last match, leaving the earlier on registration
- client off removes the first match, leaving the later on registration
- client off removes the first match, leaving the later once registration
- client off removes only the named registration
- client removeAllListeners(event) clears that event only
- server off(event) without a listener throws
- client off(event) without a listener clears that event
- removeAllListeners() does not stop room cleanup
- removeAllListeners() leaves catch-all listeners in place
Side-specific snapshots, live arrays, counts, names, and once wrappers.
- a fresh server socket exposes only its internal error listener
- server listeners are fresh snapshots with duplicates and unwrapped once callbacks
- server listenerCount filters direct and once registrations for string and symbol names
- server event names delete empty keys and reinsert them at the end
- client listeners expose the live array and component-emitter once wrapper
- client last-off and once exhaustion empty and detach the old backing array
- client introspection is available before connect for reserved events
Room cleanup, the reason each side reports, and what happens to a pending ack.
- drops direct sends from the old server Socket after a client disconnect
- drops direct sends from the old server Socket after a server disconnect
- a disconnected socket no longer receives emits for that room
- client connected and disconnected remain exact inverses across teardown
- a room disappears from the adapter when its last member disconnects
- whole-socket cleanup removes the sid from adapter membership
- a disconnected socket cannot join rooms again
- a reconnected socket does not automatically rejoin its previous rooms
- rooms are still present at disconnecting and empty at disconnect
- a pending client.emitWithAck rejects when the connection drops
- disconnect clears a pending client timeout before rejecting emitWithAck
- a disconnect from an outgoing observer clears the current emitWithAck timeout
- client disconnect settles a sent timed callback once and clears its timer
- server Socket disconnect settles a sent client timed callback once
- an outgoing observer disconnect settles the timed callback being sent
- a trailing-callback ack is silently discarded when the connection drops
- a pending server.emitWithAck stays pending when the client disconnects
- client.disconnect() reports io client disconnect to the client and client namespace disconnect to the server
- serverSocket.disconnect() reports io server disconnect to the client and server namespace disconnect to the server
- disconnecting carries the same reason and fires before disconnect
Dropping or draining already-queued packets according to the receiver and teardown path that owns the connection lifecycle.
- drops client packets queued behind a server Socket disconnect without packet middleware
- drops client packets queued behind a server Socket disconnect with packet middleware
- drops server packets queued behind a client disconnect
- drops client packets queued behind Server.close() without packet middleware
- drops client packets queued behind Server.close() with packet middleware
- drains client packets admitted before client.disconnect()
- drains server packets queued before Server.close()
- preserves FIFO in both directions while the connection remains active
Namespace grouping, connection-wide teardown order, independent Managers, and reconnect cleanup.
- disconnect(false) closes only its namespace socket
- disconnect(true) is inert after that server socket disconnects with false
- disconnect(true) closes shared namespaces in connection order before returning
- disconnect(true) from a connection handler includes the initiator and isolates opt-outs
- disconnect(true) cancels pending namespace admission on the shared Manager
- reentrant client disconnects do not duplicate shared Manager teardown
- disconnect(true) leaves duplicate and opted-out Managers connected
- shared Manager teardown rejects client acks and permits explicit reconnect
- disconnect(true) from a stale server socket leaves the reconnect connected
Server-wide teardown, its reasons, and what happens to pending acknowledgements.
- close invokes its callback and reports when called again
- close rejects a connection started immediately before it
- close rejects a connection whose callback auth resolves after shutdown
- close rejects a connection whose namespace middleware resolves after shutdown
- close rejects dynamic admission allowed after shutdown
- close disconnects every namespace with the shutdown reasons
- close rejects a pending client emitWithAck
- close settles a sent client timed callback once and clears its timer
- close leaves a pending server emitWithAck pending
- close does not cancel an armed server acknowledgement timeout
What emit, listener, middleware, connect, and disconnect methods hand back, and which chain.
- the client emit returns the socket, so it chains
- a buffered emit returns the socket too, before the connection completes
- the server socket emit returns true rather than the socket
- the server emit returns true
- a namespace emit returns true
- a broadcast emit returns true
- a timed broadcast emit returns true
- a timed server socket emit returns true, where the client one chains
- a volatile emit follows its own side: true on the server, the socket on the client
- a dropped volatile emit still returns the emitter it was called on
- the client listener methods return the socket, so they chain
- the server socket listener methods return the socket, so they chain
- chained registrations both take effect
- a namespace on returns the namespace, so it chains
- server and namespace use return the object they register on
- client connect returns the socket while connected and when reconnecting
- client disconnect returns the socket whether or not it is connected
- server socket disconnect returns that socket
Node and component-emitter aliases, listener order, wrappers, removal, delegation, and max-listener state.
- Server listener methods delegate state and runtime identity to the root Namespace
- Namespace prepend methods order connection listeners and expose once wrappers
- ParentNamespace snapshots inherited listener ordering when each child is created
- server Socket inherited methods preserve Node ordering and raw listener identity
- named listener callbacks receive their Namespace or Socket receiver
- Node emitter aliases remove the last matching registration
- once wrapper identity properties remain specific to each emitter side
- max-listener state is receiver-local and Server delegates it to root
- Node receivers warn once when a listener count exceeds their local maximum
- Namespace removal and filtered counts follow Node EventEmitter
- Node eventNames uses property-key order for integers, strings, and symbols
- Namespace meta-events collide with Socket.IO reserved outgoing names
- Server delegates the newListener collision to the root Namespace
- bulk removal of the final removeListener observer follows the host and receiver
- server Socket meta-events collide before add and after once removal
- client source and declaration aliases share component-emitter identity
- client removeAllListeners with no event clears every ordinary listener
- retained once wrappers fire once on Namespace, ParentNamespace, and server Socket
- retained prependOnceListener wrappers fire once on Namespace, ParentNamespace, and server Socket
- once fires once when an earlier listener invokes its retained wrapper
- prependOnceListener fires once when an earlier listener invokes its retained wrapper
These cases ran against ws 8.23.0 and the ws mock from the same test file and passed on both. They cover the internal basic runtime; package entry points and the rest of the selected ws contract require their own checks.
Caller storage changed after send or from its callback, offset views, and consecutive sends reusing one Buffer.
- client caller byte storage changed immediately preserves the sent Buffer bytes
- client caller byte storage changed immediately preserves the sent offset Uint8Array bytes
- client caller byte storage changed immediately preserves the sent offset DataView bytes
- client caller byte storage changed immediately preserves the sent ArrayBuffer bytes
- client caller byte storage changed immediately preserves the sent SharedArrayBuffer bytes
- client caller byte storage changed in the callback preserves the sent Buffer bytes
- client caller byte storage changed in the callback preserves the sent offset Uint8Array bytes
- client caller byte storage changed in the callback preserves the sent offset DataView bytes
- client caller byte storage changed in the callback preserves the sent ArrayBuffer bytes
- client caller byte storage changed in the callback preserves the sent SharedArrayBuffer bytes
- server caller byte storage changed immediately preserves the sent Buffer bytes
- server caller byte storage changed immediately preserves the sent offset Uint8Array bytes
- server caller byte storage changed immediately preserves the sent offset DataView bytes
- server caller byte storage changed immediately preserves the sent ArrayBuffer bytes
- server caller byte storage changed immediately preserves the sent SharedArrayBuffer bytes
- server caller byte storage changed in the callback preserves the sent Buffer bytes
- server caller byte storage changed in the callback preserves the sent offset Uint8Array bytes
- server caller byte storage changed in the callback preserves the sent offset DataView bytes
- server caller byte storage changed in the callback preserves the sent ArrayBuffer bytes
- server caller byte storage changed in the callback preserves the sent SharedArrayBuffer bytes
- client caller byte storage keeps separate message bytes when consecutive sends reuse one Buffer
- server caller byte storage keeps separate message bytes when consecutive sends reuse one Buffer
Malformed text and close reasons, received close code validation, error identity, and per-side closing outcomes.
- client invalid incoming data rejects invalid lead text and stops later incoming messages
- client invalid incoming data rejects truncated sequence text and stops later incoming messages
- client invalid incoming data rejects overlong sequence text and stops later incoming messages
- client invalid incoming data rejects surrogate text and stops later incoming messages
- server invalid incoming data rejects invalid lead text and stops later incoming messages
- server invalid incoming data rejects truncated sequence text and stops later incoming messages
- server invalid incoming data rejects overlong sequence text and stops later incoming messages
- server invalid incoming data rejects surrogate text and stops later incoming messages
- client invalid incoming data accepts the same bytes as binary data
- server invalid incoming data accepts the same bytes as binary data
- client invalid incoming data rejects a malformed close reason
- server invalid incoming data rejects a malformed close reason
- client invalid incoming data rejects the reserved code produced by truncating 1004.5
- client invalid incoming data rejects the reserved code produced by truncating 1005.5
- client invalid incoming data rejects the reserved code produced by truncating 1006.5
- server invalid incoming data rejects the reserved code produced by truncating 1004.5
- server invalid incoming data rejects the reserved code produced by truncating 1005.5
- server invalid incoming data rejects the reserved code produced by truncating 1006.5
- client invalid incoming data validates the received code before the reason
- server invalid incoming data validates the received code before the reason
- client invalid incoming data ignores a malformed reason when no close code was supplied
- server invalid incoming data ignores a malformed reason when no close code was supplied
- client invalid incoming data keeps an already-sent close when invalid text arrives during closing
- server invalid incoming data keeps an already-sent close when invalid text arrives during closing
Concurrent close information, close and terminate combinations, pending sends, and connection cancellation during shutdown.
- keeps each peer close result when the client closes first
- keeps each peer close result when the server closes first
- client close and pending delivery handles opposite-side close and terminate with close first
- client close and pending delivery handles opposite-side close and terminate with terminate first
- server close and pending delivery handles opposite-side close and terminate with close first
- server close and pending delivery handles opposite-side close and terminate with terminate first
- client close and pending delivery reports the queued close to the peer when its sender terminates
- server close and pending delivery reports the queued close to the peer when its sender terminates
- client close and pending delivery completes an accepted send once when the sender terminates
- client close and pending delivery completes an accepted send once when the receiver terminates
- server close and pending delivery completes an accepted send once when the sender terminates
- server close and pending delivery completes an accepted send once when the receiver terminates
- client close and pending delivery receives the still-open peer send before normal close completes
- server close and pending delivery receives the still-open peer send before normal close completes
- client close and pending delivery ends both sockets once when a message handler terminates the closing initiator
- server close and pending delivery ends both sockets once when a message handler terminates the closing initiator
- rejects a queued connection when its server shuts down and permits reuse
Failed and cancelled connection attempts, recovery, and server close event and callback order.
- closes a failed connection to a missing server and permits reuse of the address
- rejects a mismatched path before accepting a later matching client
- rejects a secure target against a plain server before accepting a later matching client
- cancels a CONNECTING client with close before server admission
- cancels a CONNECTING client with terminate before server admission
- runs stopped-server callbacks on the close event and only once per call
Buffer-compatible inputs, binary overrides, receive binaryType, and state-dependent send callbacks.
- client selected send API sends string with inferred binary=false and an asynchronous callback
- client selected send API sends number with inferred binary=false and an asynchronous callback
- client selected send API sends zero with inferred binary=false and an asynchronous callback
- client selected send API sends Buffer with inferred binary=true and an asynchronous callback
- client selected send API sends ArrayBuffer with inferred binary=true and an asynchronous callback
- client selected send API sends SharedArrayBuffer with inferred binary=true and an asynchronous callback
- client selected send API sends offset Uint8Array with inferred binary=true and an asynchronous callback
- client selected send API sends offset Uint16Array with inferred binary=true and an asynchronous callback
- client selected send API sends offset DataView with inferred binary=true and an asynchronous callback
- client selected send API sends array with inferred binary=true and an asynchronous callback
- client selected send API sends empty string with inferred binary=false and an asynchronous callback
- client selected send API sends empty Buffer with inferred binary=true and an asynchronous callback
- client selected send API sends coercible array with inferred binary=true and an asynchronous callback
- client selected send API sends valueOf string with inferred binary=true and an asynchronous callback
- client selected send API sends valueOf bytes with inferred binary=true and an asynchronous callback
- client selected send API sends primitive string with inferred binary=true and an asynchronous callback
- client selected send API sends primitive string after null valueOf with inferred binary=true and an asynchronous callback
- client selected send API sends primitive string after undefined valueOf with inferred binary=true and an asynchronous callback
- client selected send API sends primitive string without a prototype with inferred binary=true and an asynchronous callback
- server selected send API sends string with inferred binary=false and an asynchronous callback
- server selected send API sends number with inferred binary=false and an asynchronous callback
- server selected send API sends zero with inferred binary=false and an asynchronous callback
- server selected send API sends Buffer with inferred binary=true and an asynchronous callback
- server selected send API sends ArrayBuffer with inferred binary=true and an asynchronous callback
- server selected send API sends SharedArrayBuffer with inferred binary=true and an asynchronous callback
- server selected send API sends offset Uint8Array with inferred binary=true and an asynchronous callback
- server selected send API sends offset Uint16Array with inferred binary=true and an asynchronous callback
- server selected send API sends offset DataView with inferred binary=true and an asynchronous callback
- server selected send API sends array with inferred binary=true and an asynchronous callback
- server selected send API sends empty string with inferred binary=false and an asynchronous callback
- server selected send API sends empty Buffer with inferred binary=true and an asynchronous callback
- server selected send API sends coercible array with inferred binary=true and an asynchronous callback
- server selected send API sends valueOf string with inferred binary=true and an asynchronous callback
- server selected send API sends valueOf bytes with inferred binary=true and an asynchronous callback
- server selected send API sends primitive string with inferred binary=true and an asynchronous callback
- server selected send API sends primitive string after null valueOf with inferred binary=true and an asynchronous callback
- server selected send API sends primitive string after undefined valueOf with inferred binary=true and an asynchronous callback
- server selected send API sends primitive string without a prototype with inferred binary=true and an asynchronous callback
- client selected send API sends ArrayBuffer from another realm
- client selected send API sends SharedArrayBuffer from another realm
- server selected send API sends ArrayBuffer from another realm
- server selected send API sends SharedArrayBuffer from another realm
- client selected send API honors the binary option for binary string
- client selected send API honors the binary option for text bytes
- client selected send API honors the binary option for explicit undefined
- server selected send API honors the binary option for binary string
- server selected send API honors the binary option for text bytes
- server selected send API honors the binary option for explicit undefined
- client selected send API switches binaryType between Buffer and ArrayBuffer without changing text messages
- server selected send API switches binaryType between Buffer and ArrayBuffer without changing text messages
- client selected send API ignores unsupported binaryType assignments
- server selected send API ignores unsupported binaryType assignments
- client selected send API delivers mixed text and byte messages in send order through a final marker
- server selected send API delivers mixed text and byte messages in send order through a final marker
- client selected send API delivers queued text and bytes before a subsequent close and completes each callback once
- server selected send API delivers queued text and bytes before a subsequent close and completes each callback once
- client selected send API throws payload conversion errors before scheduling a callback while OPEN
- client selected send API throws payload conversion errors before scheduling a callback while CLOSING
- client selected send API throws payload conversion errors before scheduling a callback while CLOSED
- server selected send API throws payload conversion errors before scheduling a callback while OPEN
- server selected send API throws payload conversion errors before scheduling a callback while CLOSING
- server selected send API throws payload conversion errors before scheduling a callback while CLOSED
- client selected send API reports a send callback error while CLOSING
- client selected send API reports a send callback error while CLOSED
- server selected send API reports a send callback error while CLOSING
- server selected send API reports a send callback error while CLOSED
- client selected send API invalid payloads while OPEN rejects plain object synchronously without invoking its callback
- client selected send API invalid payloads while OPEN rejects invalid primitive conversion synchronously without invoking its callback
- client selected send API invalid payloads while OPEN rejects unsupported valueOf result synchronously without invoking its callback
- client selected send API invalid payloads while CLOSING rejects plain object synchronously without invoking its callback
- client selected send API invalid payloads while CLOSING rejects invalid primitive conversion synchronously without invoking its callback
- client selected send API invalid payloads while CLOSING rejects unsupported valueOf result synchronously without invoking its callback
- client selected send API invalid payloads while CLOSED rejects plain object synchronously without invoking its callback
- client selected send API invalid payloads while CLOSED rejects invalid primitive conversion synchronously without invoking its callback
- client selected send API invalid payloads while CLOSED rejects unsupported valueOf result synchronously without invoking its callback
- server selected send API invalid payloads while OPEN rejects plain object synchronously without invoking its callback
- server selected send API invalid payloads while OPEN rejects invalid primitive conversion synchronously without invoking its callback
- server selected send API invalid payloads while OPEN rejects unsupported valueOf result synchronously without invoking its callback
- server selected send API invalid payloads while CLOSING rejects plain object synchronously without invoking its callback
- server selected send API invalid payloads while CLOSING rejects invalid primitive conversion synchronously without invoking its callback
- server selected send API invalid payloads while CLOSING rejects unsupported valueOf result synchronously without invoking its callback
- server selected send API invalid payloads while CLOSED rejects plain object synchronously without invoking its callback
- server selected send API invalid payloads while CLOSED rejects invalid primitive conversion synchronously without invoking its callback
- server selected send API invalid payloads while CLOSED rejects unsupported valueOf result synchronously without invoking its callback
- throws on send while CONNECTING before invoking a callback
Client set membership, tracking options, cleanup, sender selection, and message order for each connection.
- tracks accepted sockets with the omitted setting
- tracks accepted sockets with the true setting
- tracks accepted sockets with the false setting
- tracks accepted sockets with the explicit undefined setting
- broadcasts through the public clients set to every accepted socket
- retains the same client set across additional connections and disconnections
- forwards consecutive text messages in order including the sender
- forwards consecutive text messages in order excluding the sender
- owns established sockets with clientTracking false
- owns established sockets with clientTracking explicit undefined
URL normalization and snapshots, synchronous URL errors, close code checks, UTF-8 reason limits, and validation order across socket states.
- rejects malformed URL not a URL synchronously
- rejects malformed URL ws:// synchronously
- rejects malformed URL ws://localhost:65536 synchronously
- [rejects malformed URL ws://::1 synchronously
- rejects malformed URL ws://localhost:bad synchronously
- rejects unsupported protocol in ftp://localhost synchronously
- rejects unsupported protocol in mailto:someone@example.test synchronously
- rejects a nonempty fragment in ws://127.0.0.1/#room synchronously
- rejects a nonempty fragment in https://127.0.0.1/#room synchronously
- normalizes HTTP://127.0.0.1:80 before attempting a connection
- normalizes https://127.0.0.1:443 before attempting a connection
- normalizes ws://127.0.0.1:80/a/../chat?room=one before attempting a connection
- normalizes wss://[::1]:443 before attempting a connection
- normalizes ws://127.0.0.1/chat room?room=two words before attempting a connection
- accepts URL suffix # and preserves it in url
- accepts URL suffix %23room and preserves it in url
- preserves the caller URL object when normalizing http://127.0.0.1/chat?room=one
- preserves the caller URL object when normalizing https://127.0.0.1/chat?room=one
- snapshots the normalized URL before the caller changes the URL object
- client close input validation rejects code 999 without leaving OPEN
- client close input validation rejects code 1004 without leaving OPEN
- client close input validation rejects code 1005 without leaving OPEN
- client close input validation rejects code 1006 without leaving OPEN
- client close input validation rejects code 1015 without leaving OPEN
- client close input validation rejects code 2999 without leaving OPEN
- client close input validation rejects code 5000 without leaving OPEN
- client close input validation rejects code -1 without leaving OPEN
- client close input validation rejects code NaN without leaving OPEN
- client close input validation rejects code Infinity without leaving OPEN
- client close input validation rejects code 1014.5 without leaving OPEN
- server close input validation rejects code 999 without leaving OPEN
- server close input validation rejects code 1004 without leaving OPEN
- server close input validation rejects code 1005 without leaving OPEN
- server close input validation rejects code 1006 without leaving OPEN
- server close input validation rejects code 1015 without leaving OPEN
- server close input validation rejects code 2999 without leaving OPEN
- server close input validation rejects code 5000 without leaving OPEN
- server close input validation rejects code -1 without leaving OPEN
- server close input validation rejects code NaN without leaving OPEN
- server close input validation rejects code Infinity without leaving OPEN
- server close input validation rejects code 1014.5 without leaving OPEN
- client close input validation rejects non-number code 1000
- client close input validation rejects non-number code null
- client close input validation rejects non-number code true
- server close input validation rejects non-number code 1000
- server close input validation rejects non-number code null
- server close input validation rejects non-number code true
- client close input validation accepts code 1000 and reports its integer value to both ends
- client close input validation accepts code 1001 and reports its integer value to both ends
- client close input validation accepts code 1002 and reports its integer value to both ends
- client close input validation accepts code 1003 and reports its integer value to both ends
- client close input validation accepts code 1007 and reports its integer value to both ends
- client close input validation accepts code 1008 and reports its integer value to both ends
- client close input validation accepts code 1009 and reports its integer value to both ends
- client close input validation accepts code 1010 and reports its integer value to both ends
- client close input validation accepts code 1011 and reports its integer value to both ends
- client close input validation accepts code 1012 and reports its integer value to both ends
- client close input validation accepts code 1013 and reports its integer value to both ends
- client close input validation accepts code 1014 and reports its integer value to both ends
- client close input validation accepts code 3000 and reports its integer value to both ends
- client close input validation accepts code 4999 and reports its integer value to both ends
- client close input validation accepts code 3000.75 and reports its integer value to both ends
- server close input validation accepts code 1000 and reports its integer value to both ends
- server close input validation accepts code 1001 and reports its integer value to both ends
- server close input validation accepts code 1002 and reports its integer value to both ends
- server close input validation accepts code 1003 and reports its integer value to both ends
- server close input validation accepts code 1007 and reports its integer value to both ends
- server close input validation accepts code 1008 and reports its integer value to both ends
- server close input validation accepts code 1009 and reports its integer value to both ends
- server close input validation accepts code 1010 and reports its integer value to both ends
- server close input validation accepts code 1011 and reports its integer value to both ends
- server close input validation accepts code 1012 and reports its integer value to both ends
- server close input validation accepts code 1013 and reports its integer value to both ends
- server close input validation accepts code 1014 and reports its integer value to both ends
- server close input validation accepts code 3000 and reports its integer value to both ends
- server close input validation accepts code 4999 and reports its integer value to both ends
- server close input validation accepts code 3000.75 and reports its integer value to both ends
- client close input validation rejects a ASCII string reason exceeding 123 bytes
- client close input validation rejects a multibyte string reason exceeding 123 bytes
- client close input validation rejects a Buffer reason exceeding 123 bytes
- server close input validation rejects a ASCII string reason exceeding 123 bytes
- server close input validation rejects a multibyte string reason exceeding 123 bytes
- server close input validation rejects a Buffer reason exceeding 123 bytes
- client close input validation delivers a empty string reason as UTF-8 bytes
- client close input validation delivers a ASCII boundary reason as UTF-8 bytes
- client close input validation delivers a multibyte boundary reason as UTF-8 bytes
- client close input validation delivers a Buffer boundary reason as UTF-8 bytes
- client close input validation delivers a unpaired surrogate reason as UTF-8 bytes
- server close input validation delivers a empty string reason as UTF-8 bytes
- server close input validation delivers a ASCII boundary reason as UTF-8 bytes
- server close input validation delivers a multibyte boundary reason as UTF-8 bytes
- server close input validation delivers a Buffer boundary reason as UTF-8 bytes
- server close input validation delivers a unpaired surrogate reason as UTF-8 bytes
- client close input validation ignores an oversized reason when the code is omitted
- server close input validation ignores an oversized reason when the code is omitted
- client close input validation ignores invalid arguments while already CLOSING or CLOSED
- server close input validation ignores invalid arguments while already CLOSING or CLOSED
- aborts a CONNECTING socket before validating close arguments
Event objects, callback receivers, property replacement, duplicate listeners, once, and interaction with EventEmitter removal.
- client ws event listeners starts with null event properties and uses a fresh event object for each listener
- accepted ws event listeners starts with null event properties and uses a fresh event object for each listener
- client ws event listeners binds function callbacks to the socket and handleEvent callbacks to their object
- accepted ws event listeners binds function callbacks to the socket and handleEvent callbacks to their object
- client ws event listeners ignores duplicate listener registration and keeps the first once option
- accepted ws event listeners ignores duplicate listener registration and keeps the first once option
- client ws event listeners removes an event listener without removing an onmessage property or ordinary emitter callback
- accepted ws event listeners removes an event listener without removing an onmessage property or ordinary emitter callback
- client ws event listeners moves replaced event properties to the end of the listener order and clears them with null
- accepted ws event listeners moves replaced event properties to the end of the listener order and clears them with null
- client ws event listeners reflects EventEmitter removal in property getters and permits re-registration
- accepted ws event listeners reflects EventEmitter removal in property getters and permits re-registration
- client ws event listeners clears an event property when assigned a non-function value
- accepted ws event listeners clears an event property when assigned a non-function value
- client ws event listeners tracks object listeners by identity for duplicate registration and removal
- accepted ws event listeners tracks object listeners by identity for duplicate registration and removal
- client ws event listeners retains binary event data identity when the underlying emitter supplies bytes
- accepted ws event listeners retains binary event data identity when the underlying emitter supplies bytes
- client ws event listeners wraps an Error without changing its identity and treats onerror as an error listener
- accepted ws event listeners wraps an Error without changing its identity and treats onerror as an error listener
- client ws event listeners uses an empty event message when an emitted error has no message
- accepted ws event listeners uses an empty event message when an emitted error has no message
- client ws event listeners ignores unsupported event types without removing ordinary emitter listeners
- accepted ws event listeners ignores unsupported event types without removing ordinary emitter listeners
- client ws event listeners delivers normal close information as string reason and wasClean=true
- accepted ws event listeners delivers normal close information as string reason and wasClean=true
- client ws event listeners uses wasClean=false after abrupt termination
- accepted ws event listeners uses wasClean=false after abrupt termination
- client ws event listeners delivers real text through the event property while the emitter still receives bytes
- accepted ws event listeners delivers real text through the event property while the emitter still receives bytes
- dispatches an open event with the client as target and callback receiver
Registration, removal, dispatch, snapshots, raw once wrappers, and listener bookkeeping on the server and both socket sides.
- server EventEmitter returns its receiver from registration/removal and uses Node method aliases
- client socket EventEmitter returns its receiver from registration/removal and uses Node method aliases
- accepted socket EventEmitter returns its receiver from registration/removal and uses Node method aliases
- server EventEmitter emits synchronously in registration order with duplicate listeners, arguments, and receiver
- client socket EventEmitter emits synchronously in registration order with duplicate listeners, arguments, and receiver
- accepted socket EventEmitter emits synchronously in registration order with duplicate listeners, arguments, and receiver
- server EventEmitter removes the most recently registered matching listener and ignores missing listeners
- client socket EventEmitter removes the most recently registered matching listener and ignores missing listeners
- accepted socket EventEmitter removes the most recently registered matching listener and ignores missing listeners
- server EventEmitter returns fresh listener snapshots and exposes once wrappers before and after emit
- client socket EventEmitter returns fresh listener snapshots and exposes once wrappers before and after emit
- accepted socket EventEmitter returns fresh listener snapshots and exposes once wrappers before and after emit
- server EventEmitter runs a raw once wrapper only once and binds its owner even when called with a different receiver
- client socket EventEmitter runs a raw once wrapper only once and binds its owner even when called with a different receiver
- accepted socket EventEmitter runs a raw once wrapper only once and binds its owner even when called with a different receiver
- server EventEmitter allows a raw wrapper listener to be called without consuming the once registration
- client socket EventEmitter allows a raw wrapper listener to be called without consuming the once registration
- accepted socket EventEmitter allows a raw wrapper listener to be called without consuming the once registration
- server EventEmitter does not rerun a once listener when an earlier listener recursively emits the event
- client socket EventEmitter does not rerun a once listener when an earlier listener recursively emits the event
- accepted socket EventEmitter does not rerun a once listener when an earlier listener recursively emits the event
- server EventEmitter takes a dispatch snapshot when listeners add or remove other listeners
- client socket EventEmitter takes a dispatch snapshot when listeners add or remove other listeners
- accepted socket EventEmitter takes a dispatch snapshot when listeners add or remove other listeners
- server EventEmitter consumes a once registration before propagating its callback exception
- client socket EventEmitter consumes a once registration before propagating its callback exception
- accepted socket EventEmitter consumes a once registration before propagating its callback exception
- server EventEmitter removes symbol listeners in reverse order while preserving other events
- client socket EventEmitter removes symbol listeners in reverse order while preserving other events
- accepted socket EventEmitter removes symbol listeners in reverse order while preserving other events
- server EventEmitter orders integer event names before other strings and symbols and returns a snapshot
- client socket EventEmitter orders integer event names before other strings and symbols and returns a snapshot
- accepted socket EventEmitter orders integer event names before other strings and symbols and returns a snapshot
- server EventEmitter distinguishes an omitted removeAllListeners argument from explicit undefined
- client socket EventEmitter distinguishes an omitted removeAllListeners argument from explicit undefined
- accepted socket EventEmitter distinguishes an omitted removeAllListeners argument from explicit undefined
- server EventEmitter emits usable newListener/removeListener notifications with unwrapped once callbacks
- client socket EventEmitter emits usable newListener/removeListener notifications with unwrapped once callbacks
- accepted socket EventEmitter emits usable newListener/removeListener notifications with unwrapped once callbacks
- server EventEmitter rethrows an unhandled Error object and delivers handled errors synchronously
- client socket EventEmitter rethrows an unhandled Error object and delivers handled errors synchronously
- accepted socket EventEmitter rethrows an unhandled Error object and delivers handled errors synchronously
Server registration, request basics, text Buffer delivery, normal close, and address reuse.
- assigns a port and exposes address() through a separate constructor callback receiver
- connects asynchronously and supplies request basics and socket-side URLs
- delivers text as Buffer with isBinary=false in both directions, including an immediate server greeting
- closes both ends normally from client with code undefined and a Buffer reason
- closes both ends normally from client with code 1000 and a Buffer reason
- closes both ends normally from server with code undefined and a Buffer reason
- closes both ends normally from server with code 1000 and a Buffer reason
- releases a server registration so the same address can be used again
- normalizes HTTP URLs and rejects invalid URLs synchronously
- rejects sends before open and ignores sends during and after normal close
- reports an address collision without unregistering the listening server
- waits for connected sockets before completing server close callbacks
- emits close again when closing a stopped server without a callback
These have no oracle to compare against: they cover the API smocket adds (differences.md §B) and the internals behind it. Native Socket.IO-mock cases run under both projects; virtual ws rules run only in the mock project. They establish no real-library equivalence.
Network-free delivery, independent Socket.IO state, virtual host registration, local aliases, and path selection. These mock-specific rules are not real-network equivalence claims.
- exchanges messages without creating an HTTP server or opening a TCP connection
- matches local aliases for localhost without changing the client URL
- matches local aliases for LOCALHOST without changing the client URL
- matches local aliases for 0:0:0:0:0:0:0:1 without changing the client URL
- keeps ws registrations alive when a Socket.IO server at the same address closes
- keeps registrations with the same port on different hosts separate
- rejects a different virtual host before accepting a matching client
- does not connect a wrong-path client and still accepts a later matching client
- cancels listening when closed before the deferred listening notification
- closes a listening server without a callback and releases its address
- cleans up both sockets when a client aborts inside the connection handler before open
- drains an accepted peer send before completing normal close
- handles close on an internal socket before pairing
- handles terminate on an internal socket before pairing
Port and host validation, default ports, wildcard lookup and collisions, and virtual port exhaustion and reuse. These checks exercise the in-memory registry only.
- rejects invalid virtual port -1
- rejects invalid virtual port 65536
- rejects invalid virtual port 1.5
- rejects invalid virtual port NaN
- rejects invalid virtual port Infinity
- rejects unsupported server host example.test
- rejects unsupported server host 256.0.0.1
- rejects unsupported server host 127.0.0
- routes default ws and wss ports to the matching registration
- limits IPv4 wildcard lookup and detects wildcard collisions in either registration order
- accepts IPv4 and IPv6 targets through an IPv6 wildcard
- skips occupied ports, wraps the allocator, reports exhaustion, and reuses a released port
Discarding or retaining acknowledgements as appropriate when a smocket outgoing observer tears down a connection mid-send.
- discards an ack retained after an outgoing observer disconnects the client
- skips a buffered timed promise settled during reconnect flush
- stops reconnect flushing when an outgoing observer disconnects
Resolving a url to a server, and what the url contributes to the handshake.
- connect(url) resolves to the server registered for that origin
- a missing-server socket exposes disconnected state and mutable auth
- handshake.url is the normalized origin the client connected to
- two spellings of one origin resolve to the same server
- a bare https origin resolves to the same server as its default port
- connect(url) caches one Manager per normalized origin unless opted out
- the url's query string lands on handshake.query
- connect(url, { auth }) puts the auth object on the handshake
- a function auth holds the pairing until its callback fires
- a function auth is re-evaluated on each connection, including a reconnect
- a completed reconnect resets client.recovered to false
- the url query wins wholesale over the options query when both are given
- the options query is used only when the url carries none
- the url's path selects the namespace
- connect(url) rejects an unregistered namespace without creating membership
- a relative url resolves against location.origin
- connect(url) to an unregistered origin fires connect_error, without throwing
- a failed client still rejects reserved names on every emit wrapper
- close unregisters the server so later connect(url) reports a missing server
- closing a replaced server does not unregister its replacement
- the socket from a failed connect still chains
- a failed client carries the complete catch-all listener surface
- a failed client carries component-emitter listener introspection
Keeping out-of-scope binary-containing packets on the existing in-memory path without an encoding claim.
- keeps binary-containing direct packets on the existing in-memory path in both directions
- keeps binary-containing acknowledgement payloads on the existing in-memory path
Registering an adapter that changes the routing decision.
- Adapter ignores deletion for membership it does not hold
- broadcast routing ignores stale sids returned by a custom adapter
- io.adapter registers a custom adapter that observes the routing decision
- a custom adapter can drop a socket from the target set, and per-socket order still holds
- registering a custom adapter preserves per-socket delivery order
- builds an independent registered adapter for each dynamic concrete child
Factory isolation, setup boundaries, and whole-socket cleanup.
- builds isolated adapters for root, existing, future static, and dynamic namespaces
- keeps every existing adapter unchanged when replacement construction fails
- rejects one adapter instance shared by multiple namespaces without partial replacement
- reports dynamic adapter construction failure and lets the client retry
- does not register a future static namespace when its adapter construction fails
- rejects reusing an existing adapter for a future namespace
- closes adapter registration at the first connection attempt, including rejection
- signals whole-socket removal once for the client teardown path
- signals whole-socket removal once for the server teardown path
- signals whole-socket removal once for the manager teardown path
- signals whole-socket removal once for the close teardown path
- signals cleanup once for rejected and cancelled admission without lifecycle events
Recording immutable final broadcast routing decisions without payloads.
- records one final decision for Server, Namespace, room, exclusion, and Socket entry points
- keeps root and named namespace history isolated
- records a dynamic parent broadcast once in each concrete namespace
- records empty and volatile final recipient sets plus callback and Promise ack broadcasts
- records before outgoing observation and delivery without changing FIFO
- excludes direct socket traffic and failed broadcast encoding
- returns caller-cleared immutable snapshots with no payload reference
- observes recipients after a wrapped custom adapter changes routing
- composes with DelayingAdapter scheduling and removal
A smocket-only final-recipient filter by sid, including acknowledgements, cleanup, namespace isolation, and adapter composition.
- drops io.emit by sid and restores delivery without changing membership
- preserves room union, exclusions, sender exclusion, and unaffected direct traffic
- removes dropped recipients from callback and Promise acknowledgement collection
- does not cancel a broadcast acknowledgement already selected before the drop
- skips outgoing observation for dropped delivery and preserves remaining FIFO
- cleans state on disconnect, gives reconnect a fresh sid, and isolates namespaces
- composes dropping before tracing with wrapped delayed FIFO delivery
- receives the ordered final ids after volatile filtering and cannot add or reorder
Keeping local management selection on canonical Socket state instead of custom event routing and delivery filtering.
- management lookup ignores custom routing and delivery dropping
- bulk membership ignores custom routing and delivery dropping
- bulk disconnect ignores custom routing and delivery dropping
Holding a socket's client-inbound stream so a race can be interleaved on purpose.
- an emit from a connection handler reaches the client, before the pairing completes
- a delayed socket is held on the timer while an undelayed one still arrives next tick
- does not delay the server side: a client emit is received on the next tick
- preserves order within a delayed socket's stream, and holds it until the delay elapses
- a lowered delay does not let a new event overtake one already queued
- a new delay applies only to deliveries scheduled after it is set
- gates order through the queue, not the timer: only the head is ever scheduled
- ignores a non-finite delay rather than storing NaN or Infinity
- keeps delay state when the socket leaves only its id room
- drains a queued stream during close without duplicating scheduled callbacks
- drains the remaining queue when the scheduled head triggers teardown
- does not carry an old sid delay into a reconnect
- cancels only the removed socket timer after draining its queued delivery
- releases the default timer when draining a queued delivery throws
Applying smocket-only pre-connect volatile selection before acknowledgement counting.
The encoder behind the id shape the dual run pins.
- encodes bytes the way base64url does, url-safe alphabet included
- strips the padding a length off a multiple of three produces
- an id is 15 random bytes run through that encoder
What the package exports, including the io name the substitution path needs.
- connecting pairs the client and server socket with the same id
- exports
ioas socket.io-client's name for connect, so a module swap works - exports the contract types, so the swap keeps an app annotations to use
- exports a server type that keeps the smocket-only members
- exports the tracing adapter and trace type
- exports the deterministic dropping adapter
Pairing direct clients with server sockets, namespace queue order, admission outcomes, and close settlement.
- connect and nextConnection expose both sides of one admitted socket
- pairs wait-before-connect and connect-before-wait in connection order
- pairs connect-before-wait on a registered named namespace
- pairs multiple waiting observers with clients in FIFO order
- returns multiple ready sockets in FIFO order
- normalizes namespace names while keeping their queues isolated
- keeps direct connections in the established Manager groups
- skips rejected admission and resolves the waiter with the next accepted socket
- skips cancelled admission and resolves the waiter with the next accepted socket
- offers a repeatedly completed Socket to the direct API only once
- does not leave a claimed Socket queued after a repeated middleware error
- close rejects pending static and dynamic namespace observers
- close discards unclaimed sockets and rejects later observers
- close preserves a ready socket claimed before teardown
Validating port messages, generations, acknowledgements, ordering, errors, and explicit teardown around the existing in-process server.
- shared-worker protocol validates message shape, direction, and protocol version at both boundaries
- shared-worker host connects through the existing server and carries acknowledgements both ways
- shared-worker host keeps client events FIFO through an acknowledgement marker
- shared-worker host ends the old generation and suppresses its late events and acknowledgements
- shared-worker host reports malformed and unexpected messages without stopping the port
- shared-worker host reports host delivery failures and survives an undeliverable report
- shared-worker host releases a connection when its admission result cannot cross the port
- shared-worker host tolerates a port that cannot carry a bridge error
- shared-worker host reports connection rejection and releases the failed generation
- shared-worker host disconnects a generation replaced before its connection callback
- shared-worker host closes an active host once and preserves its shutdown reason
- shared-worker host disconnects explicitly with the page-supplied reason
- shared-worker host reports BigInt encoding failures and reserved packets before a later acknowledgement marker
- shared-worker host reports circular encoding failures and reserved packets before a later acknowledgement marker
- shared-worker host lets an application outgoing listener exception escape without reporting a bridge error
- shared-worker host reports an invalid acknowledgement payload and keeps the server acknowledgement usable
- rejects reserved event packet names at both SharedWorker boundaries
Connecting through the narrow page API, listener behavior, acknowledgements, stale-generation suppression, and bridge errors.
- reports JSON encoding failures and releases failed client acknowledgements before a later marker
- shared-worker client facade connects automatically, snapshots auth, buffers emits, and explicitly replaces the active generation
- shared-worker client facade matches the supported ordinary and incoming catch-all listener behavior
- shared-worker client facade carries callback, promise, send, and server acknowledgements exactly once
- shared-worker client facade drops stale generation traffic and retained acknowledgements before a later marker
- shared-worker client facade reports invalid and non-cloneable traffic without stopping later delivery
- shared-worker client facade ignores host messages that do not belong to the current local state
- shared-worker client facade reports a server-initiated disconnect while locally connected
- shared-worker client facade finishes an immediate disconnect after the initial admission
- shared-worker client facade stays disconnected when the initial port post fails
- shared-worker client facade stops flushing a buffered batch when delivery changes connection state
- shared-worker client facade drops a server acknowledgement after local connection state ends
- shared-worker client facade reports admission failure once and uses current auth on an explicit retry
- shared-worker client facade disconnects once on pagehide and releases page lifecycle ownership
- shared-worker client facade incoming catch-all callbacks receive the owning page socket
Running the documented lobby handlers against real Socket.IO and smocket, including duplicate-label identity, readiness, start, and disconnect.
- the documented lobby handlers preserve identity and lifecycle across both targets
- normalizes a blank label and rejects readiness after departure
These checks run once in the mock project. They verify repository tooling, not Socket.IO delivery or the native smocket API.
Rejecting unsuccessful test processes and aggregate reports before generating or certifying the case list.
- reads a report only from a successful test process
- rejects a failed mock process even when its JSON report says cases passed
- rejects a signalled real process even when its JSON report says cases passed
- rejects aggregate failure even when individual cases passed and the process exits zero
- preserves spawn errors before trying to read a report
- fails the write command without changing the report after a test process fails
- fails the check command without changing the report after a test process fails
The gaps above are the shortest route into this repository, because a contribution here is judged mechanically rather than by taste.
- Put it in the area file it belongs to under
src/. A new file also needs an entry in the area table inscripts/conformance-report.mjs, which fails the run rather than dropping an unlisted file from this page. - Run
pnpm test:realfirst. Red here means the case states something socket.io does not do, so the case is wrong and the mock is not involved yet. - Then run
pnpm test:mock. Green on the real target and red on the mock is a divergence found, not a mistake made, and it arrives with its reproduction already written. Open it as an issue or fix the mock to match. - Prove non-receipt with a marker, never with a timeout. See the dual run above.
- Run
pnpm conformanceand commit the regenerated page. CI runs the same generation and fails if this file no longer matches the suite.
Each row is answered by a CI job rather than by a claim, so the evidence is in
.github/workflows/ci.yml.
| Question | Answer | Job |
|---|---|---|
| Which Node runs the suite | 22 and 24 on Linux, current LTS on Windows and macOS | test |
| Which Node runs the published package | 20 and up, the floor engines.node declares |
declared node floor |
| Which TypeScript consumes the types | 5.0.2 and up, under NodeNext and Bundler | package |
| Which Socket.IO the cases hold for | Exact root server and client pins, recorded above | test, public surface ledger |
| Which browser the mock runs in | Chromium, mock target only | browser |
Each release follows one declared Socket.IO server and client target under 0043. The dual run compares that target's behavior with smocket, and type checks compare the covered declarations. The root pins and installed versions must agree; examples and consumers must use the same exact upstream pins. A differing version is unverified unless explicitly validated. Earlier releases retain their documented support, without a maintenance guarantee.
The browser row is narrower on purpose. A page cannot host a socket.io server, so there is no real target to compare against there, and the job asks only whether the mock behaves in a browser the way it behaves in Node.
The number promises fidelity to socket.io, not the result your suite got last week. A correction that moves the mock toward measured real behaviour is therefore a minor release even when it turns a passing test red, because the diverging result was never what the version promised.
- A correction toward measured real behaviour: minor when it changes what is delivered, patch when nothing observable moves.
- Newly covered socket.io surface: minor.
- Removing or altering a deliberate divergence from differences.md §A: major. Adding one: no bump, since it documents what was already happening.
- A public type change: minor if existing call sites still compile, major otherwise.
- Raising
engines.node: major. Lowering it: minor.
Before 1.0.0 every rule applies one place to the right, the way npm reads a 0.x range.
A release that changes what is delivered also carries its own section in the notes, with
the before and after as results and a link to the case above that pins the new
behaviour. The reasoning is in
0019.