Skip to content

Add RIS Live WebSocket streaming support to WASM package #297

Description

@digizeph

Feature request

Add RIS Live support to the @bgpkit/parser WebAssembly package so JavaScript and TypeScript users can parse RIPE RIS Live WebSocket messages in browser, Worker, and Node.js environments.

Current state

The WASM package exposes parsers for BGP UPDATE, BMP/OpenBMP, and MRT records, but it does not currently expose RIS Live helpers:

  • no parseRisLiveMessageJson(...) export
  • no parseRisLiveMessageRaw(...) export
  • no WebSocket convenience helper for RIS Live subscriptions
  • the WASM feature path does not currently include the RIS Live/raw-message dependencies needed for parsing socketOptions.includeRaw messages

Proposed API

Start with lower-level parser exports:

parseRisLiveMessageJson(message: string): BgpElem[]
parseRisLiveMessageRaw(message: string): BgpElem[]

Then optionally add a convenience WebSocket helper:

const stream = connectRisLive({
  host: 'rrc00',
  includeRaw: true,
});

for await (const elems of stream) {
  for (const elem of elems) {
    console.log(elem.prefix, elem.as_path);
  }
}

Design notes

  • Prefer includeRaw: true for full BGP wire-message parsing, preserving attributes omitted by RIS Live's JSON projection.
  • Keep the parser exports independent from transport so browser, Worker, and Node.js users can bring their own WebSocket implementation.
  • If adding a WebSocket helper, consider whether Node.js support should use an optional dependency or require callers to provide a WebSocket constructor.
  • Update WASM TypeScript definitions, README, and examples.

Acceptance criteria

  • @bgpkit/parser exports RIS Live JSON and raw-message parsing helpers.
  • TypeScript definitions cover the new APIs.
  • Documentation includes a RIS Live WebSocket example.
  • Tests cover at least one JSON-projected RIS Live UPDATE and one includeRaw RIS Live UPDATE.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions