Emitting
// Ack declared → Promise, rejecting on validation failure or timeout.
const ack = await client.modules.chat.sendMessage(
{ roomId: "r1", text: "hi" },
{ timeoutMs: 3_000, signal: controller.signal },
);
// No ack declared → void, throwing synchronously on an invalid payload.
client.modules.chat.typing({ roomId: "r1", isTyping: true });
// Validate now, send on the next connect.
client.modules.chat.typing.queue({ roomId: "r1", isTyping: false });queue() validates at call time, so a malformed payload fails where you
wrote it instead of going out unvalidated minutes later. Buffered frames flush
in order on connect; the buffer is bounded by maxQueueSize (default 100) and
evicts oldest-first.
Acks are validated. If the server answers sendMessage with something that
doesn't match the ack schema, the promise rejects with a
SocketValidationError rather than resolving a value whose type is a lie.