Interface ProtocolConnection

interface ProtocolConnection {
    onClose: Event<void>;
    onDispose: Event<void>;
    onError: Event<[Error, undefined | Message, undefined | number]>;
    onUnhandledNotification: Event<NotificationMessage>;
    dispose(): void;
    end(): void;
    hasPendingResponse(): boolean;
    listen(): void;
    onNotification<RO>(
        type: ProtocolNotificationType0<RO>,
        handler: NotificationHandler0,
    ): Disposable;
    onNotification(
        type: NotificationType0,
        handler: NotificationHandler0,
    ): Disposable;
    onNotification<P, RO>(
        type: ProtocolNotificationType<P, RO>,
        handler: NotificationHandler<P>,
    ): Disposable;
    onNotification<P>(
        type: NotificationType<P>,
        handler: NotificationHandler<P>,
    ): Disposable;
    onNotification(
        method: string,
        handler: GenericNotificationHandler,
    ): Disposable;
    onProgress<P>(
        type: ProgressType<P>,
        token: string | number,
        handler: NotificationHandler<P>,
    ): Disposable;
    onRequest<R, PR, E, RO>(
        type: ProtocolRequestType0<R, PR, E, RO>,
        handler: RequestHandler0<R, E>,
    ): Disposable;
    onRequest<R, E>(
        type: RequestType0<R, E>,
        handler: RequestHandler0<R, E>,
    ): Disposable;
    onRequest<P, R, PR, E, RO>(
        type: ProtocolRequestType<P, R, PR, E, RO>,
        handler: RequestHandler<P, R, E>,
    ): Disposable;
    onRequest<P, R, E>(
        type: RequestType<P, R, E>,
        handler: RequestHandler<P, R, E>,
    ): Disposable;
    onRequest<R, E>(
        method: string,
        handler: GenericRequestHandler<R, E>,
    ): Disposable;
    sendNotification(type: NotificationType0): Promise<void>;
    sendNotification<RO>(type: ProtocolNotificationType0<RO>): Promise<void>;
    sendNotification<P, RO>(
        type: ProtocolNotificationType<P, RO>,
        params?: P,
    ): Promise<void>;
    sendNotification<P>(type: NotificationType<P>, params?: P): Promise<void>;
    sendNotification(method: string): Promise<void>;
    sendNotification(method: string, params: any): Promise<void>;
    sendProgress<P>(
        type: ProgressType<P>,
        token: string | number,
        value: P,
    ): Promise<void>;
    sendRequest<R, PR, E, RO>(
        type: ProtocolRequestType0<R, PR, E, RO>,
        token?: CancellationToken,
    ): Promise<R>;
    sendRequest<R, E>(
        type: RequestType0<R, E>,
        token?: CancellationToken,
    ): Promise<R>;
    sendRequest<P, R, PR, E, RO>(
        type: ProtocolRequestType<P, R, PR, E, RO>,
        params: P,
        token?: CancellationToken,
    ): Promise<R>;
    sendRequest<P, R, E>(
        type: RequestType<P, R, E>,
        params: P,
        token?: CancellationToken,
    ): Promise<R>;
    sendRequest<R>(method: string, token?: CancellationToken): Promise<R>;
    sendRequest<R>(
        method: string,
        param: any,
        token?: CancellationToken,
    ): Promise<R>;
    trace(
        value: Trace,
        tracer: Tracer,
        sendNotification?: boolean,
    ): Promise<void>;
    trace(
        value: Trace,
        tracer: Tracer,
        traceOptions?: TraceOptions,
    ): Promise<void>;
}

Properties

onClose: Event<void>

An event emitter firing when the connection got closed.

onDispose: Event<void>

An event emitter firing when the connection got disposed.

onError: Event<[Error, undefined | Message, undefined | number]>

An event emitter firing when an error occurs on the connection.

onUnhandledNotification: Event<NotificationMessage>

An event emitter firing when the connection receives a notification that is not handled.

Methods

  • Actively disposes the connection.

    Returns void

  • Ends the connection.

    Returns void

  • Returns true if the connection has a pending response. Otherwise false is returned.

    Returns boolean

  • Turns the connection into listening mode

    Returns void

  • Installs a progress handler for a given token.

    Type Parameters

    • P

    Parameters

    Returns Disposable

    A disposable to remove the handler.

  • Sends a notification.

    Parameters

    Returns Promise<void>

    A promise that resolves when the notification is written to the network layer.

  • Type Parameters

    • RO

    Parameters

    Returns Promise<void>

  • Sends a notification.

    Type Parameters

    • P
    • RO

    Parameters

    Returns Promise<void>

    A promise that resolves when the notification is written to the network layer.

  • Type Parameters

    • P

    Parameters

    Returns Promise<void>

  • Sends a notification.

    Parameters

    • method: string

      the notification's method name.

    Returns Promise<void>

    A promise that resolves when the notification is written to the network layer.

  • Sends a notification.

    Parameters

    • method: string

      the notification's method name.

    • params: any

      the notification's parameters.

    Returns Promise<void>

    A promise that resolves when the notification is written to the network layer.

  • Sends progress.

    Type Parameters

    • P

    Parameters

    • type: ProgressType<P>

      the progress type

    • token: string | number

      the token to use

    • value: P

      the progress value

    Returns Promise<void>

    A promise that resolves when the progress is written to the network layer.

  • Sends a request and returns a promise resolving to the result of the request.

    Type Parameters

    • R
    • PR
    • E
    • RO

    Parameters

    Returns Promise<R>

    A promise resolving to the request's result.

  • Type Parameters

    • R
    • E

    Parameters

    Returns Promise<R>

  • Sends a request and returns a promise resolving to the result of the request.

    Type Parameters

    • P
    • R
    • PR
    • E
    • RO

    Parameters

    Returns Promise<R>

    A promise resolving to the request's result.

  • Type Parameters

    • P
    • R
    • E

    Parameters

    Returns Promise<R>

  • Sends a request and returns a promise resolving to the result of the request.

    Type Parameters

    • R

    Parameters

    • method: string

      the method name.

    • Optionaltoken: CancellationToken

      An optional cancellation token.

    Returns Promise<R>

    A promise resolving to the request's result.

  • Sends a request and returns a promise resolving to the result of the request.

    Type Parameters

    • R

    Parameters

    • method: string

      the method name.

    • param: any
    • Optionaltoken: CancellationToken

      An optional cancellation token.

    Returns Promise<R>

    A promise resolving to the request's result.

  • Enables tracing mode for the connection.

    Parameters

    • value: Trace
    • tracer: Tracer
    • OptionalsendNotification: boolean

    Returns Promise<void>

    A promise that resolves when the trace value is written to the network layer.

  • Parameters

    Returns Promise<void>