# werift-sctp

> SCTP protocol implementation for Node.js written in TypeScript.

Latest version **0.0.11** (published 2026-02-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install werift-sctp
pnpm add werift-sctp
yarn add werift-sctp
bun add werift-sctp
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.0.11 |
| Published | 2026-02-16 |
| First published | 2021-02-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 349.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | shinyoshiaki |
| Maintainers | shinyoshiaki |

## Links

- npm: https://www.npmjs.com/package/werift-sctp
- Repository: https://github.com/shinyoshiaki/werift-sctp
- Issues: https://github.com/shinyoshiaki/werift-sctp/issues
- npm.io page: https://npm.io/package/werift-sctp

## Dependencies (1)

- [@shinyoshiaki/jspack](https://npm.io/package/@shinyoshiaki/jspack.md) ^0.0.6

## Recent versions

- 0.0.11 (latest) — 2026-02-16
- 0.0.10 — 2026-02-16
- 0.0.9 — 2026-02-15
- 0.0.8 — 2026-02-15
- 0.0.7 — 2026-02-15
- 0.0.6 — 2025-01-13
- 0.0.5 — 2023-01-15
- 0.0.4 — 2021-02-16

## README

# werift-sctp

SCTP Implementation for TypeScript  
based on aiortc/sctp

# Example

```typescript
import { createSocket } from "dgram";
import { SCTP, WEBRTC_PPID, createUdpTransport } from "werift-sctp";

const port = 5555;

const socket = createSocket("udp4");
socket.bind(port);

const server = SCTP.server(createUdpTransport(socket));
server.onReceive.subscribe((streamId, ppId, data) => {
  console.log(data.toString());
  server.send(0, WEBRTC_PPID.STRING, Buffer.from("pong"));
});

const client = SCTP.client(
  createUdpTransport(createSocket("udp4"), {
    port,
    address: "127.0.0.1",
  })
);
client.onReceive.subscribe((streamId, ppId, data) => {
  console.log(data.toString());
});

await Promise.all([client.start(5000), server.start(5000)]);
await Promise.all([
  client.stateChanged.connected.asPromise(),
  server.stateChanged.connected.asPromise(),
]);

client.send(0, WEBRTC_PPID.STRING, Buffer.from("ping"));
```

`SCTP.stop()` stops the SCTP association only. It does not close the underlying transport automatically, so close your UDP socket (or transport) explicitly when your application is done with it.
`onReceive` is an `Event<[streamId, ppId, data]>`; use `subscribe`, `once`, or `asPromise` (not assignment).

# reference

-
- RFC4960
- RFC6083
- RFC6525
- RFC8261
- aiortc https://github.com/aiortc/aiortc
- pion/sctp https://github.com/pion/sctp

---
_Source: https://npm.io/package/werift-sctp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
