import { ArkosEmitTarget, ArkosSocket, ArkosUserTarget } from "./types"; import { Socket } from "socket.io"; export declare class ArkosBroadcastOperatorImpl { private readonly sockets; private readonly operator; constructor(sockets: Map, operator: ArkosEmitTarget); user(userId: string): ArkosUserTarget; /** * Returns all unique user IDs currently in the target room(s). * Uses the internal `arkos::user:` room convention to map sockets to users. * * @example * const users = await socket.to("room-123").users() * console.log(users) // ['user-1', 'user-2'] */ users(): Promise; /** * Excludes sockets from the broadcast. * Accepts a room name, socket ID, array of rooms/IDs, or `{ user: string | string[] }` * to exclude all sockets belonging to one or more users. * * @example * socket.to("room-101").except("room-102").emit("foo", data) * socket.broadcast.except({ user: userId }).emit("foo", data) * socket.broadcast.except({ user: [id1, id2] }).emit("foo", data) */ except(room: string | string[] | { user: string | string[]; }): ArkosBroadcastOperatorImpl; /** * Emits an event to the target. `_meta` (`mid` + `timestamp`) is injected automatically. * * @example * socket.to("room-101").emit("message", { text: "hello" }) * socket.broadcast.emit("announcement", data) */ emit(event: string, ...args: any[]): boolean; /** * Sets the volatile flag — the event may be dropped if the client is not ready. * Useful for high-frequency non-critical events like cursor positions or typing indicators. * * @example * socket.to("room-101").volatile.emit("cursor", position) */ get volatile(): ArkosBroadcastOperatorImpl; /** * Sets the compress flag for the next emission. * * @example * socket.broadcast.compress(false).emit("ping", data) */ compress(value: boolean): ArkosBroadcastOperatorImpl; /** * Sets a timeout in milliseconds for `emitWithAck`. * Rejects the promise if no client acknowledges within the given delay. * * @example * socket.to("room-101").timeout(3000).emitWithAck("confirm", data) */ timeout(ms: number): ArkosBroadcastOperatorImpl; /** * Emits an event and waits for acknowledgements from all matched clients. * `_meta` is injected automatically. Use `.timeout(ms)` to avoid hanging indefinitely. * * @example * const responses = await socket.to("room-101").timeout(3000).emitWithAck("confirm", data) */ emitWithAck(event: string, ...args: any[]): Promise; } /** * Mounts Arkos socket extensions and patches emit methods for automatic `_meta` injection. * Called once by the gateway at connection time, right after injecting `_arkos`. * * Patches: `emit`, `emitWithAck`, `to()`, `timeout()`, `broadcast` * Mounts: `user()`, `peer()`, `retry()` * * @internal * @since 1.7.0-canary.29 */ export declare function mountArkosSocketExtensions(socket: ArkosSocket): void;