Skip to content

fix: expose volatile after broadcast narrowing #231

Closed

Description

@electrohyun

Description

Smocket's narrowed BroadcastOperator stores its internal volatile flag in a property named volatile. That internal boolean occupies the public API name, so a chain such as io.to(room).volatile does not expose another broadcast operator.

Socket.IO exposes volatile after broadcast narrowing. The correction should separate the private flag from the public operator view and preserve the flag through every supported chain involving to, in, except, and timeout.

The affected public forms include io.to(room).volatile, namespace broadcasts, socket.to(room).volatile, and socket.broadcast.volatile, including supported alternative orderings. Event maps and other public generics must propagate through the returned wrappers.

ADR 0016 already defines Smocket's volatile delivery semantics, so this issue does not reopen when volatile packets are dropped. Exact operator identity, immutability, chain order, and the common Socket.IO 4.7/4.8 surface still need direct verification.

Reproduction

import { connect, Server } from 'smocket';

const URL = 'http://localhost:3000';
const io = new Server(URL);
const client = connect(URL);
const socket = await io.nextConnection();

await socket.join('room');

// Expected: `volatile` is a broadcast operator with emit(), not a boolean flag.
io.to('room').volatile.emit('message', 'hello');
socket.to('room').volatile.emit('message', 'hello');
socket.broadcast.volatile.emit('message', 'hello');

Completion requires paired runtime cases across every reachable public form and consumer type fixtures proving that narrowing does not lose event maps.

smocket version

0.4.2

Environment

Node 22, Vitest 4; Socket.IO 4.8.3 reference probe, with Socket.IO 4.7 and 4.8 verification required

Activity

  1. added this to the v0.4.3 milestone on Aug 12, 2026
  2. added
    bug
    fidelity
    on Aug 12, 2026
  3. moved this from Backlog to In progress in smocketon Aug 12, 2026
  4. moved this from In progress to Done in smocketon Aug 12, 2026
  5. self-assigned this
    on Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugfidelity

Type

No type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions