/**
 * Copyright 2025 Angus.Fenying <fenying@litert.org>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import type * as NodeHttp from 'node:http';
import type * as Listener from '../http-listener';
import type * as dT from '../Transporter.decl';
export interface IRegisterListenerOptions {
    onErrorCallback: (e: Error) => void;
    onUpgradeCallback: (req: NodeHttp.IncomingMessage, socket: NodeJS.Socket, head: Buffer) => void;
}
export interface IRegisterListenerResult {
    stop?: () => void | Promise<void>;
    start?: () => void | Promise<void>;
    readonly running: boolean;
}
export interface IWebSocketGatewayOptions {
    /**
     * The timeout of WebSocket connections.
     *
     * > Set to 0 to disable timeout.
     *
     * @default 60000
     */
    timeout?: number;
}
/**
 * Create a WebSocket gateway, binding to a simple built-in HTTP(S) listener.
 *
 * > When using built-in HTTP server, the api will ignore other headers, path and query string in the URL.
 *
 * @param listener      The HTTP(S) listener object.
 * @param server        The televoke server object.
 */
export declare function createWebsocketGateway(listener: Listener.IHttpListener, server: dT.IServer, options?: IWebSocketGatewayOptions): dT.IGateway;
/**
 * Create a WebSocket gateway, binding to a custom HTTP server.
 *
 * > When using a custom HTTP server, it's able to preprocess the request before passing to the server, like
 * > authentication, rate limiting, custom routing, etc.
 *
 * @param registerListener  The function to register the listener to the custom HTTP server.
 * @param server            The server to process the requests.
 */
export declare function createCustomWebsocketGateway(registerListener: (opts: IRegisterListenerOptions) => IRegisterListenerResult, server: dT.IServer): dT.IGateway;
//# sourceMappingURL=WebSocket.Server.d.ts.map