AppleSauce
    Preparing search index...

    Interface IRelay

    interface IRelay {
        authenticated: boolean;
        authenticated$: Observable<boolean>;
        challenge: null | string;
        challenge$: Observable<null | string>;
        connected: boolean;
        connected$: Observable<boolean>;
        message$: Observable<any>;
        notice$: Observable<string>;
        notices: string[];
        notices$: Observable<string[]>;
        url: string;
        auth(event: Event): Observable<{ message?: string; ok: boolean }>;
        event(event: Event): Observable<PublishResponse>;
        multiplex(
            subMsg: () => any,
            unsubMsg: () => any,
            messageFilter: (value: any) => boolean,
        ): Observable<any>;
        publish(
            event: Event,
            opts?: { retries?: number },
        ): Observable<PublishResponse>;
        req(filters: FilterInput, id?: string): Observable<SubscriptionResponse>;
        request(
            filters: FilterInput,
            opts?: { id?: string; retries?: number },
        ): Observable<Event>;
        subscription(
            filters: FilterInput,
            opts?: { id?: string; retries?: number },
        ): Observable<SubscriptionResponse>;
    }

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    authenticated: boolean
    authenticated$: Observable<boolean>
    challenge: null | string
    challenge$: Observable<null | string>
    connected: boolean
    connected$: Observable<boolean>
    message$: Observable<any>
    notice$: Observable<string>
    notices: string[]
    notices$: Observable<string[]>
    url: string

    Methods

    • Send an AUTH message

      Parameters

      • event: Event

      Returns Observable<{ message?: string; ok: boolean }>

    • Creates an Observable, that when subscribed to, sends a message, defined by the subMsg function, to the server over the socket to begin a subscription to data over that socket. Once data arrives, the messageFilter argument will be used to select the appropriate data for the resulting Observable. When finalization occurs, either due to unsubscription, completion, or error, a message defined by the unsubMsg argument will be sent to the server over the WebSocketSubject.

      Parameters

      • subMsg: () => any

        A function to generate the subscription message to be sent to the server. This will still be processed by the serializer in the WebSocketSubject's config. (Which defaults to JSON serialization)

      • unsubMsg: () => any

        A function to generate the unsubscription message to be sent to the server at finalization. This will still be processed by the serializer in the WebSocketSubject's config.

      • messageFilter: (value: any) => boolean

        A predicate for selecting the appropriate messages from the server for the output stream.

      Returns Observable<any>

    • Send a REQ message with retries

      Parameters

      • filters: FilterInput
      • Optionalopts: { id?: string; retries?: number }

      Returns Observable<Event>