import { Message } from '../constants'; import { SocketWrapper, DeepstreamConfig, DeepstreamServices } from '@deepstream/types'; /** * The MessageProcessor consumes blocks of parsed messages emitted by the * ConnectionEndpoint, checks if they are permissioned and - if they * are - forwards them. */ export default class MessageProcessor { private services; private bulkResults; constructor(config: DeepstreamConfig, services: DeepstreamServices); /** * There will only ever be one consumer of forwarded messages. So rather than using * events - and their performance overhead - the messageProcessor exposes * this method that's expected to be overwritten. */ onAuthenticatedMessage(socketWrapper: SocketWrapper, message: Message): void; /** * This method is the way the message processor accepts input. It receives arrays * of parsed messages, iterates through them and issues permission requests for * each individual message * * @todo The responses from the permission service might arrive in any arbitrary order - order them * @todo Handle permission handler timeouts */ process(socketWrapper: SocketWrapper, parsedMessages: Message[]): void; private onBulkPermissionResponse; /** * Processes the response that's returned by the permission service. */ private onPermissionResponse; private processInvalidResponse; }