import { Tracer } from '@opentelemetry/api';
import WebSocket from 'isomorphic-ws';
import { ISocket, SocketError, SocketMessage } from './socket.js';
import { GenericMiddleware, ISocketClient, MethodHandler, MethodHandlers, RequestContextBase, SocketTimeouts } from './types.js';
/**
 * @deprecated Use `TracedSocket` from `@superblocksteam/telemetry` instead.
 * This class will be removed in a future version.
 *
 * Migration:
 * ```typescript
 * // Before
 * import { TracedSocket } from '@superblocksteam/shared';
 *
 * // After
 * import { TracedSocket, getTelemetryInstance } from '@superblocksteam/telemetry';
 * const { policyEvaluator } = getTelemetryInstance();
 * new TracedSocket(ws, handlers, middlewares, { requestHeaders, policyEvaluator }, options);
 * ```
 */
export declare class TracedSocket<ImplementedMethods, CallableMethods, RequestContext extends RequestContextBase> extends ISocket<ImplementedMethods, CallableMethods, RequestContext> {
    /**
     * The TracedSocket class extends the ISocket class to add tracing capabilities for each connection. It manages
     * spans for handler calls to provide detailed tracing information.
     *
     * Unlike Express, the ISocket handler call chain is fully recursive. This recursion makes it challenging to determine
     * when to create and end spans for specific handlers, as handlers may call other handlers before returning a result.
     *
     * An example span for recursive call
     * Main span ----------------------------------------------------------------------------------
     * Handler1     ----------------------------------------------------------------------------
     * Handler2           ----------------------------------------------------------------------
     *
     * To manage this, we keep a reference to the most recently created span and complete that span when we go one step deeper into the recursion.
     * This approach works for now since we don't support much parallelism, but it will need to be updated when we start handling requests concurrently.
     *
     * An example span for recursive call after the above fixes
     * Main span ----------------------------------------------------------------------------------
     * Handler1     -----------------------------
     * Handler2                                  ------------------------------------------------
     *
     */
    private activeSpanByRequestId;
    private middlewareSpanByReqId;
    private lastActiveSpan;
    private tracer;
    constructor(ws: WebSocket, requestHandlers: MethodHandlers<ImplementedMethods, CallableMethods, RequestContext>, globalMiddlewares: GenericMiddleware<CallableMethods, RequestContext>[], tracer: Tracer, options: {
        onClose: (event: WebSocket.CloseEvent) => void;
        timeouts?: SocketTimeouts;
        logger?: {
            error: (message?: string) => void;
            info: (message?: string) => void;
            warn: (message?: string) => void;
        };
    });
    protected callHandler<Params, Result, CallableMethods, RequestContext extends RequestContextBase>(handler: MethodHandler<Params, Result, CallableMethods, RequestContext>, params: Params, ctx: RequestContext, client: ISocketClient<CallableMethods>, next: () => Promise<Result>): Promise<Result>;
    protected handleMessage(message: SocketMessage): Promise<void>;
    request<Params, Result>(method: string, params: Params, authorization?: string): Promise<Result>;
    protected decorateToSend(message: SocketMessage): SocketMessage;
    protected respond<Result>(requestId: number, result: Result): void;
    protected respondError(requestId: number, error: SocketError, exception?: Error): void;
    private addEvent;
    close(reason?: string): void;
}
//# sourceMappingURL=tracedSocket.d.ts.map