UNPKG

@nestjs/websockets

Version:

WebSockets for NestJS: gateways with message handlers, guards, pipes and interceptors, on Socket.IO or ws.

15 lines (14 loc) • 1.08 kB
import { type ObservableInput, type OperatorFunction } from 'rxjs'; /** * `mergeMap(project, concurrent)` for the messages of a client, which decides * how many arrive before the first one has been handled. `mergeMap()` removes * each completed inner subscription from an array of all the active ones, and * `shift()`s each waiting value off an array of all the waiting ones, so a * burst costs time quadratic in its size. Here at most `concurrent` inner * subscriptions are active, and the values that wait for their turn are kept * in a linked list. `onBacklog` is told when values start and stop waiting, * e.g. to stop reading from the client in the meantime. Where reading cannot * be stopped, `maxWaiting` caps the list: a value that arrives while that many * wait is dropped, and `onOverflow` is called, e.g. to disconnect the client. */ export declare function mergeMapBounded<T, R>(project: (value: T) => ObservableInput<R>, concurrent: number, onBacklog?: (isBacklogged: boolean) => void, maxWaiting?: number, onOverflow?: () => void): OperatorFunction<T, R>;