Skip to content

Latest commit

 

History

History
52 lines (36 loc) · 1.54 KB

README.md

File metadata and controls

52 lines (36 loc) · 1.54 KB

Koochooloo RTP

NPM Version NPM Downloads GitHub Actions Workflow Status

Introduction

RealTime Protocol implementation based on RFC 3550 in NodeJS. It supports RTP and SR message of RTCP. All contributions are welcome. KRTP has support for rxjs and Node streams.

Installation

npm install krtp

krtp is an ES module and requires Node.js 20 or newer.

Example

import { Session } from "krtp";

const s = new Session(1373);

s.on("message", (msg) => {
  console.log(msg);
  s.close();
});

s.sendSR("192.168.73.4").catch((err) => {
  console.log(err);
});
s.send(Buffer.from("Hello world"));
import { Session } from "krtp";

const s = new Session(1372);
s.message$.subscribe((msg) => console.log(msg));

A session binds the RTP port and the RTCP port (port + 1). Malformed datagrams are dropped and reported through the error event when a listener is attached; they never crash the process. Incoming sender reports are emitted as sr events or through the sr$ observable.