papi-dts
    Preparing search index...

    A WebSocket whose wire is an Electron MessagePort to the main process instead of a TCP socket. Chromium closes every TCP client socket when the OS suspends; a MessagePort is a Mojo pipe, which observes no power events, so the connection survives sleep.

    Isomorphic with the DOM WebSocket for everything RpcClient uses: readyState, url, send, close, and the open/message/error/close events. A port has no close code, so intent travels in a close frame: close(code, reason) posts one before closing the port, a frame from main is reported as main's close, and a port that closes with no frame is 1006 with wasClean: false, the same shape a websocket that died produces. pagehide closes with 1001 so a reload or window close reads as clean on main.

    Keeps the first port it is handed and ignores any other: the bridge that hands ports out is reachable from same-origin web views, and a page has exactly one connection.

    Implements

    • WebSocket
    Index

    Constructors

    Properties

    binaryType: BinaryType
    bufferedAmount: 0
    CLOSED: 3
    CLOSING: 2
    CONNECTING: 0
    extensions: "" = ''
    onclose: null | ((this: WebSocket, ev: CloseEvent) => unknown)
    onerror: null | ((this: WebSocket, ev: Event) => unknown)
    onmessage: null | ((this: WebSocket, ev: MessageEvent) => unknown)
    onopen: null | ((this: WebSocket, ev: Event) => unknown)
    OPEN: 1
    protocol: "" = ''
    readyState: number
    url: string

    Methods

    • Experimental

      Type Parameters

      • K extends keyof WebSocketEventMap

      Parameters

      • type: K
      • listener: (this: WebSocket, ev: WebSocketEventMap[K]) => unknown

      Returns void

    • Experimental

      Parameters

      • Optionalcode: number
      • Optionalreason: string

      Returns void

    • Experimental

      Parameters

      • event: Event

      Returns boolean

    • Experimental

      Type Parameters

      • K extends keyof WebSocketEventMap

      Parameters

      • type: K
      • listener: (this: WebSocket, ev: WebSocketEventMap[K]) => unknown

      Returns void

    • Experimental

      Parameters

      • data: string | ArrayBufferLike | ArrayBufferView<ArrayBufferLike> | Blob

      Returns void