web-serial-rxjs API Documentation
    Preparing search index...

    Module index

    web-serial-rxjs

    A TypeScript library that wraps the Web Serial API with a minimal, RxJS-based session surface.

    The v2 public API intentionally exposes a single, session-oriented surface so that apps (Angular, Vue, React, Svelte, vanilla JS/TS) can drive their UI entirely from state$ + isConnected$ + receive$ + terminalText$ + lines$ + errors$ without rebuilding any state, read loops, or write queues themselves.

    The Web Serial API is only available in Chromium-based browsers:

    • Chrome 89+
    • Edge 89+
    • Opera 75+

    Use SerialSession.isBrowserSupported for a synchronous feature check before calling SerialSession.connect$.

    import { createSerialSession } from '@gurezo/web-serial-rxjs';

    const session = createSerialSession({ baudRate: 115200 });

    if (!session.isBrowserSupported()) {
    console.error('Web Serial API is not supported in this browser');
    } else {
    session.state$.subscribe((state) => console.log('state:', state));
    session.receive$.subscribe((chunk) => console.log('rx:', chunk));
    session.errors$.subscribe((error) => console.error('err:', error));

    session.connect$().subscribe();
    session.send$('hello\r\n').subscribe();
    }

    Enumerations

    SerialErrorCode

    Classes

    SerialError

    Interfaces

    SerialSession
    SerialSessionOptions
    SerialSessionReceiveReplayOptions
    TerminalBuffer

    Type Aliases

    SerialSessionState

    Variables

    SerialSessionState

    Functions

    createSerialSession
    createTerminalBuffer