mirror of
https://github.com/xtr-dev/rondevu-client.git
synced 2025-12-10 02:43:25 +00:00
6466a6f52ae478d40572e83a8cc5f850add78be1
- Changed default baseUrl from rondevu.xtrdev.workers.dev to api.ronde.vu - Updated JSDoc comment for baseUrl in RondevuOptions - Version bumped to 0.3.1 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Rondevu
🎯 Simple WebRTC peer signaling and discovery
Meet peers by topic, by peer ID, or by connection ID.
Related repositories:
- rondevu-server - HTTP signaling server
- rondevu-demo - Interactive demo
@xtr-dev/rondevu-client
TypeScript client library for Rondevu peer signaling and WebRTC connection management. Handles automatic signaling, ICE candidate exchange, and connection establishment.
Install
npm install @xtr-dev/rondevu-client
Usage
Browser
import { Rondevu } from '@xtr-dev/rondevu-client';
const rdv = new Rondevu({
baseUrl: 'https://server.com',
rtcConfig: {
iceServers: [
// your ICE servers here
{ urls: 'stun:stun.l.google.com:19302' },
{ urls: 'stun:stun1.l.google.com:19302' },
{
urls: 'turn:relay1.example.com:3480',
username: 'example',
credential: 'example'
}
]
}
});
// Connect by topic
const conn = await rdv.join('room');
// Or connect by ID
const conn = await rdv.connect('meeting-123');
// Use the connection
conn.on('connect', () => {
const channel = conn.dataChannel('chat');
channel.send('Hello!');
});
Node.js
In Node.js, you need to provide a WebRTC polyfill since WebRTC APIs are not natively available:
npm install @roamhq/wrtc
# or
npm install wrtc
import { Rondevu } from '@xtr-dev/rondevu-client';
import wrtc from '@roamhq/wrtc';
import fetch from 'node-fetch';
const rdv = new Rondevu({
baseUrl: 'https://server.com',
fetch: fetch as any,
wrtc: {
RTCPeerConnection: wrtc.RTCPeerConnection,
RTCSessionDescription: wrtc.RTCSessionDescription,
RTCIceCandidate: wrtc.RTCIceCandidate,
},
rtcConfig: {
iceServers: [
{ urls: 'stun:stun.l.google.com:19302' }
]
}
});
// Rest is the same as browser usage
const conn = await rdv.join('room');
conn.on('connect', () => {
const channel = conn.dataChannel('chat');
channel.send('Hello from Node.js!');
});
API
Main Methods:
rdv.join(topic)- Auto-connect to first peer in topicrdv.join(topic, {filter})- Connect to specific peer by IDrdv.create(id, topic)- Create connection for others to joinrdv.connect(id)- Join connection by ID
Connection Events:
connect- Connection establisheddisconnect- Connection closeddatachannel- Remote peer created data channelstream- Remote media stream receivederror- Error occurred
Connection Methods:
conn.dataChannel(label)- Get or create data channelconn.addStream(stream)- Add media streamconn.getPeerConnection()- Get underlying RTCPeerConnectionconn.close()- Close connection
License
MIT
Description
Languages
TypeScript
96.1%
JavaScript
3.9%