/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { AppAddress } from "#net/AppAddress.js";
import { Bytes } from "#util/Bytes.js";
import { MaybePromise } from "#util/Promises.js";
/**
 * A platform-independent HTTP endpoint implementation.
 *
 * This provides a modern WinterTC-style interface with a focus on simplifying platform-specific implementations.
 */
export interface HttpEndpoint {
    /**
     * Handler for normal HTTP requests.
     */
    http?: HttpEndpoint.HttpHandler;
    /**
     * Handler for WebSocket upgrade requests.
     */
    ws?: HttpEndpoint.WsHandler;
    /**
     * Release resources for the endpoint.
     */
    close(): Promise<void>;
}
export declare namespace HttpEndpoint {
    /**
     * HTTP request callback.
     */
    type HttpHandler = (request: Request) => MaybePromise<void | Response>;
    /**
     * WebSocket request callback.
     */
    type WsHandler = (request: Request, upgrade: () => Promise<WsConnection>) => MaybePromise<void>;
    /**
     * A WebSocket connection.
     */
    interface WsConnection extends ReadableWritablePair<WsMessage, WsMessage> {
    }
    /**
     * Raw WebSocket message payload.
     */
    type WsMessage = Bytes | string;
    /**
     * Configuration options.
     */
    interface Options {
        certificate?: string;
        key?: string;
    }
    /**
     * Full configuration.
     */
    interface Configuration extends Options {
        address: AppAddress.Definition;
    }
}
//# sourceMappingURL=HttpEndpoint.d.ts.map