websocket-ts
    Preparing search index...

    Type Alias UrlProvider

    UrlProvider: string | (() => string)

    A URL or a function that returns a URL. When a function is provided, it is called on each connection attempt, enabling use cases like load balancing, auth token rotation, and failover.

    The function is called without the websocket as this and should only resolve a URL. If, during a connection attempt after construction, it synchronously calls close() or reconnect() on the websocket, the attempt that called it is abandoned without creating a socket. It must not call reconnect() on every invocation, as that recurses indefinitely.

    If it throws during an automatic retry, that attempt fails with an 'error' event (an ErrorEvent whose 'error' is the thrown value) and retrying continues. During construction and reconnect(), the exception propagates to the caller instead.