import { TemplatedApp, WebSocket, WebSocketBehavior, HttpRequest, us_listen_socket } from "uWebSockets.js";
import * as Joi from 'joi';
export interface IWS extends Partial<WebSocket> {
    publish(m: string | object): any;
    broadcast(m: string | object): any;
}
export interface IFunctor {
    Message(opt?: {
        schema: Joi.SchemaLike;
        onInvalid?: (err: any, ws: any) => void;
    }): IFunctor;
    onJoin(fn: (ws: WebSocket, request: HttpRequest) => void): IFunctor;
    onClose(cb: (ws: WebSocket, code: number, message: string) => void): IFunctor;
    onDrain(cb: (ws: WebSocket) => void): IFunctor;
    Apply(fn: (req: any, message: string | number | Object, isBinary: boolean, ws: IWS) => void): any;
}
export declare function Functor(app: TemplatedApp, routename: string, opt: WebSocketBehavior): {
    Message(opt?: {
        schema: Joi.SchemaLike;
        onInvalid?: ((err: any, ws: any) => void) | undefined;
    } | undefined): any;
    onJoin(fn: (ws: WebSocket, request: HttpRequest) => void): any;
    onClose(cb: (ws: WebSocket, code: number, message: string) => void): any;
    onDrain(cb: (ws: WebSocket) => void): any;
    Apply(fn: (req: any, message: string | number | Object, isBinary: boolean, ws: IWS) => void): void;
};
export declare function uSocket(_app: TemplatedApp, opt: WebSocketBehavior, uWS: any): {
    route(routeName: string): {
        Message(opt?: {
            schema: Joi.SchemaLike;
            onInvalid?: ((err: any, ws: any) => void) | undefined;
        } | undefined): any;
        onJoin(fn: (ws: WebSocket, request: HttpRequest) => void): any;
        onClose(cb: (ws: WebSocket, code: number, message: string) => void): any;
        onDrain(cb: (ws: WebSocket) => void): any;
        Apply(fn: (req: any, message: string | number | Object, isBinary: boolean, ws: IWS) => void): void;
    };
    onerror(cb: (err: any) => void): any;
    onsuccess(cb: (port: any, token: any) => void): any;
    listen(port: number, cb: (port: number, token: us_listen_socket) => void): TemplatedApp;
};
//# sourceMappingURL=index.d.ts.map