Simplifies real-time application development. Defines signaling protocol for connection establishment, handling media and data transmission, and provides infrastructure.
- Media & Data Support: Transmit audio, video, and/or data channels within your applications.
- Abstracted Signaling: Handles the exchange of information required to set up WebRTC connections, relieving you of low-level details.
- Automatic Reconnection: Maintains connection stability by automatically re-establishing connections when disruptions occur.
- Opt out of Peer-to-Peer: Can configure to force server-relayed communication.
The project is in active development, please refer to the roadmap to track our major milestones.
Warning
This SDK is currently in Developer Preview. During this phase:
- APIs are subject to breaking changes
- Stability issues may occur
- Core functionality is still being validated
We value your input!
Report bugs, suggest improvements, or collaborate directly with our team:
Install and import the package using npm, deno, or yarn:
Add Package
npm i @pulsebeam/peer
Import symbol
import * as peer from "@pulsebeam/peer";
Add Package
yarn add @pulsebeam/peer
Import symbol
import * as peer from "@pulsebeam/peer";
Here's an example demonstrating how to use @pulsebeam/peer to establish a peer-to-peer connection:
import { Peer, createPeer } from "@pulsebeam/peer";
// Obtain an authentication token (implementation specific)
const authResponse = await fetch("/auth");
const { groupId, token } = await authResponse.json();
// Create a Peer instance
const peer = await createPeer({ token });
peer.onsession = (session) => {
session.ontrack = ({ streams }) => console.log("New media stream:", streams);
session.ondatachannel = (event) => console.log("Data channel:", event.channel);
session.onconnectionstatechange = () => console.log("Connection state changed");
};
// Start Alice's availability. Connect to our signaling servers
peer.start();
// Connect to bob
const abortController = new AbortController();
await peer.connect(groupId, "bob", abortController.signal);
This example retrieves an authentication token (implementation details will vary depending on your setup), creates a Peer instance, and defines event handlers for receiving media streams, data channels, and connection state changes (optional). Finally, it starts connection attempts and connects to a specific peer identified by its ID within the group.
For documentation, API keys, and usage scenarios, please refer to the official PulseBeam documentation:
- Guide: https://pulsebeam.dev/docs
- Client SDK Reference: https://jsr.io/@pulsebeam/peer
- Server SDK Reference: https://jsr.io/@pulsebeam/server
This project adheres to Semantic Versioning 2.0.0.
- MAJOR version (X.y.z): Incompatible API changes.
- MINOR version (x.Y.z): Functionality added in a backwards compatible manner.
- PATCH version (x.y.Z): Backwards compatible bug fixes.
For a deeper understanding of WebRTC concepts, consult the official WebRTC documentation:
Name | Link |
---|---|
Client SDK | https://github.com/PulseBeamDev/pulsebeam-js |
Server SDK | https://github.com/PulseBeamDev/pulsebeam-core |
FOSS Server | https://github.com/PulseBeamDev/pulsebeam-server-foss |
Signaling Protocol | https://github.com/PulseBeamDev/pulsebeam-proto |
Documentation | https://github.com/PulseBeamDev/docs |
PulseBeam Cloud | https://cloud.pulsebeam.dev |