@conference-kit/core 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +56 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # @conference-kit/core
2
+
3
+ Minimal, typed WebRTC building blocks: a `Peer` class plus the supporting types you need to wire signaling and media yourself.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @conference-kit/core
9
+ ```
10
+
11
+ ## What it provides
12
+
13
+ - `Peer`: typed wrapper around `RTCPeerConnection` with optional data channel creation, track helpers, and a tiny event emitter.
14
+ - Types: `PeerConfig`, `PeerSide`, `SignalData`, `PeerControls`, and `PeerEvents` for safe signaling and media handling.
15
+
16
+ ## Quick start
17
+
18
+ ```ts
19
+ import { Peer, type SignalData } from "@conference-kit/core";
20
+
21
+ // Decide which side initiates based on your app's rule
22
+ const peer = new Peer({ side: "initiator", trickle: true });
23
+
24
+ // Send outbound signaling to your server/peer
25
+ peer.on("signal", (data: SignalData) => sendToRemote(JSON.stringify(data)));
26
+
27
+ // Receive signaling from your server/peer
28
+ async function onRemoteSignal(payload: unknown) {
29
+ await peer.signal(payload as SignalData);
30
+ }
31
+
32
+ peer.on("stream", (remote) => attachRemote(remote));
33
+ peer.on("data", (message) => console.log("received", message));
34
+ peer.on("connect", () => console.log("peer connected"));
35
+ ```
36
+
37
+ Key helpers:
38
+
39
+ - `addStream/removeStream`: keep media in sync with your connection.
40
+ - `send(data)`: push strings/buffers over the data channel (throws if not open).
41
+ - `signal(data)`: apply offers/answers/candidates you received from signaling.
42
+
43
+ ## Events
44
+
45
+ - `signal` — outbound SDP/candidates to relay.
46
+ - `stream` / `track` — remote media.
47
+ - `data` — data channel messages.
48
+ - `connect`, `close`, `error`, `iceStateChange`, `connectionStateChange` — connection lifecycle.
49
+
50
+ ## Building
51
+
52
+ ```bash
53
+ npm run build
54
+ ```
55
+
56
+ Emits ESM + `.d.ts` to `dist/`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conference-kit/core",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",