import { Message } from '../../constants';
import { DeepstreamConnectionEndpoint, DeepstreamServices, SimpleSocketWrapper, DeepstreamPlugin, DeepstreamConfig } from '@deepstream/types';
export interface HTTPEvents {
    onAuthMessage: Function;
    onPostMessage: Function;
    onGetMessage: Function;
}
interface HTTPConnectionEndpointOptionsInterface {
    enableAuthEndpoint: boolean;
    authPath: string;
    postPath: string;
    getPath: string;
    allowAuthData: boolean;
    logInvalidAuthData: boolean;
    requestTimeout: number;
}
export declare class HTTPConnectionEndpoint extends DeepstreamPlugin implements DeepstreamConnectionEndpoint {
    private pluginOptions;
    private services;
    dsOptions: DeepstreamConfig;
    description: string;
    private initialized;
    private jifHandler;
    private onSocketMessageBound;
    private onSocketErrorBound;
    private logInvalidAuthData;
    private requestTimeout;
    constructor(pluginOptions: HTTPConnectionEndpointOptionsInterface, services: DeepstreamServices, dsOptions: DeepstreamConfig);
    whenReady(): Promise<void>;
    close(): Promise<void>;
    /**
     * Initialize the http server.
     */
    init(): void;
    /**
     * Called for every message that's received
     * from an authenticated socket
     *
     * This method will be overridden by an external class and is used instead
     * of an event emitter to improve the performance of the messaging pipeline
     */
    onMessages(socketWrapper: SimpleSocketWrapper, messages: Message[]): void;
    private onGetMessage;
    /**
     * Handle a message to the authentication endpoint (for token generation).
     *
     * Passes the entire message to the configured authentication handler.
     */
    private onAuthMessage;
    /**
     * Handle a message to the POST endpoint
     *
     * Authenticates the message using authData, a token, or OPEN auth if enabled/provided.
     */
    private onPostMessage;
    /**
     * Create and initialize a new SocketWrapper
     */
    private createSocketWrapper;
    /**
     * Handle response from authentication handler relating to a POST request.
     *
     * Parses, permissions and distributes the individual messages
     */
    private onMessageAuthResponse;
    /**
     * Handle messages from deepstream socketWrappers and inserts message responses into the HTTP
     * response where possible.
     */
    private onSocketMessage;
    /**
     * Handle errors from deepstream socketWrappers and inserts message rejections into the HTTP
     * response where necessary.
     */
    private onSocketError;
    /**
     * Check whether any more responses are outstanding and finalize http response if not.
     */
    private static checkComplete;
    /**
     * Handle request timeout, sending any responses that have already resolved.
     */
    private onRequestTimeout;
    /**
     * Calculate the 'result' field in a response depending on how many responses resolved
     * successfully. Can be one of 'SUCCESS', 'FAILURE' or 'PARTIAL SUCCSS'
     */
    private static calculateMessageResult;
    /**
     * Permission an event emit and capture the response directly
     */
    private permissionEventEmit;
    /**
     * Handle an event emit permission response
     */
    private onPermissionResponse;
}
export {};
