import { WebSocketEndPoint, WebSocketSet } from '../endpoints/WebSocketEndPoint'; import { RawData } from 'ws'; import { IntentManager } from '@dooboostore/simple-boot'; import { RouterManager } from '@dooboostore/simple-boot'; export type WebSocketRequest = { webSocketSet: WebSocketSet; uuid: string; webSocketManager: WebSocketManager; sendEvent: (event: string, body: any, config?: { responseTimeout?: number; }) => Promise; }; export type TopicType = 'intent' | 'router'; export type SubscribeType = 'subscribe'; export type UnsubscribeType = 'unsubscribe'; export type TopicRequest = { type?: TopicType; uuid: string; requestUUID: string; body?: T; }; export type TopicSubscribeRequest = { type: SubscribeType; target: string; uuid: string; body?: T; }; export type TopicUnsubscribeRequest = { type: UnsubscribeType; uuid: string; }; export type TopicResponse = { state: 'success' | 'error'; target: string; uuid: string; requestUUID?: string; body: T; }; export type TopicServerEventRequest = { type: 'event'; uuid: string; eventUUID: string; event: string; body?: T; }; export type TopicServerEventUnSubscribeRequest = { type: 'unsubscribe'; uuid: string; }; export type TopicServerEventResponse = { type: 'event'; uuid: string; eventUUID: string; body?: T; }; export declare const isTopicRequest: (obj: any) => obj is TopicRequest; export declare const isTopicSubscribeRequest: (obj: any) => obj is TopicSubscribeRequest; export declare const isTopicUnsubscribeRequest: (obj: any) => obj is TopicUnsubscribeRequest; export declare const isTopicResponse: (obj: any) => obj is TopicResponse; export declare const isTopicServerEventRequest: (obj: any) => obj is TopicServerEventRequest; export declare const isTopicServerEventResponse: (obj: any) => obj is TopicServerEventResponse; export declare const isTopicServerEventUnSubscribeRequest: (obj: any) => obj is TopicServerEventUnSubscribeRequest; type EventResponseCallBack = (data: T, wsSet: WebSocketSet) => void; export type RegisteredClient = { uuid: string; target: string; subscribeBody?: T; }; type RegisteredClientSet = RegisteredClient & { webSocketSet: WebSocketSet; }; export declare class WebSocketManager implements WebSocketEndPoint { private intentManager; private routerManager; private clients; private eventSubscriptions; private subject; constructor(intentManager: IntentManager, routerManager: RouterManager); get observable(): import("@dooboostore/core").Observable | TopicSubscribeRequest | TopicServerEventResponse, any>; connect(wsSet: WebSocketSet): void; close(wsSet: WebSocketSet): void; setClientTopic(wsSet: WebSocketSet, uuid: string, target: string, subscribeBody?: any): void; findAllClientsByTarget(target: string): RegisteredClientSet[]; findClientsByTarget(target: string): RegisteredClientSet; removeClientByUUID(uuid: string): boolean; findClientByUUID(uuid: string): RegisteredClientSet | undefined; sendDataByUUID({ uuid, body }: { uuid: string; body?: any; }): boolean; sendUnSubscribeByUUID({ uuid }: { uuid: string; }): boolean; sendAllDataByTarget({ target, body }: { target: string; body?: any; }): number; sendAllUnSubscribeByTarget({ target }: { target: string; }): number; sendEventDataByUUID({ uuid, event, body }: { uuid: string; event: string; body?: any; }, config?: { responseCallBack?: EventResponseCallBack; }): string | undefined; sendEventDataByUUIDPromise({ uuid, event, body }: { uuid: string; event: string; body?: any; }, config?: { responseTimeout?: number; }): Promise; sendEventDataByUUIDPromiseSettled({ uuid, event, body }: { uuid: string; event: string; body?: any; }, config?: { responseTimeout?: number; }): Promise>; sendAllEventDataByTargetPromise({ target, event, body }: { target: string; event: string; body?: any; }, config?: { responseTimeout?: number; }): Promise<{ body: R; uuid: string; }[]>; sendAllEventDataByTargetPromiseSettled({ target, event, body }: { target: string; event: string; body?: any; }, config?: { responseTimeout?: number; }): Promise[]>; sendAllEventDataByTarget({ target, event, body }: { target: string; event: string; body?: any; }, config?: { responseCallBack?: EventResponseCallBack; }): number; private addEventSubscribes; getOpenClients(): WebSocketSet[]; private isBinaryPayload; private hasBinaryPayload; private buildBinaryTopic; private sendTopic; private parseBinaryTopic; message(wsSet: WebSocketSet, data: { data: RawData; isBinary: boolean; }): void; private removeAllClientsByWebSocketSet; } export {}; //# sourceMappingURL=WebSocketManager.d.ts.map