@ryandur/sand
    Preparing search index...

    Function streaming

    • streaming('wss://example.test/live', () => 'unreachable')
      .onOpen(socket => socket.send(subscribe))
      .onMessage(receive)
      .onClose(mourn);

      streaming owns a socket's whole life: the handshake, the flow, the ending. Message policy stays with the caller — frames arrive raw. Settled facts replay for late listeners; the flow does not. close is the one teardown, silent and idempotent: our own hanging up is not an ending worth announcing.

      Type Parameters

      • ERROR

      Parameters

      • url: string | URL
      • onError: (thrown: unknown) => ERROR
      • Optionalprotocols: string | string[]

      Returns Streaming<ERROR>