The WebSocket connection is the main class that holds a connection between the client and the server

Constructors

  • This constructor should not be called directly

    Parameters

    • url: URL

      the URL of the remote MillenniumDB server

    • onMessage: ((iobuffer) => void)

      the callback that will handle the received data

        • (iobuffer): void
        • Parameters

          Returns void

    • onError: ((error) => void)
        • (error): void
        • Parameters

          • error: string

          Returns void

    Returns WebSocketConnection

Properties

_closingPromise: null | Promise<void>
_onError: ((error) => void)

Type declaration

    • (error): void
    • Parameters

      • error: string

      Returns void

_onMessage: ((iobuffer) => void)

Type declaration

    • (iobuffer): void
    • Parameters

      Returns void

_open: boolean
_pendingRequests: IOBuffer[]
_wsOpen: boolean

Methods

  • Close the connection

    Returns Promise<void>

    Promise that will be resolved when the connection is closed

  • Write a request. If the connection is not established yet, it will be enqueued

    Parameters

    • iobuffer: IOBuffer

      a buffer containing the request

    Returns void