Files
rondevu-client/README.md
Bas van den Aakster 06fa957ccc Add high-level Rondevu client with three connection methods
- Add Rondevu class with join(), connect(), and create() methods
- Add RondevuConnection wrapper for WebRTC connections
- Add event emitter for connection events
- Update to ES modules (ESNext) for Vite compatibility
- Simplify README to be more concise
- Update package.json to specify type: module

Three ways to connect:
- join(topic) for auto-discovery
- join(topic, {filter}) for peer ID filtering
- create(id)/connect(id) for direct connections

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 21:20:27 +01:00

59 lines
1.3 KiB
Markdown

# Rondevu
🎯 Meet WebRTC peers by topic, by peer ID, or by connection ID.
## @xtr-dev/rondevu-client
Rondevu HTTP and WebRTC client, for simple peer discovery and connection.
### Install
```bash
npm install @xtr-dev/rondevu-client
```
### Usage
```typescript
import { Rondevu } from '@xtr-dev/rondevu-client';
const rdv = new Rondevu({ baseUrl: 'https://server.com' });
// 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!');
});
```
### API
**Main Methods:**
- `rdv.join(topic)` - Auto-connect to first peer in topic
- `rdv.join(topic, {filter})` - Connect to specific peer by ID
- `rdv.create(id, topic)` - Create connection for others to join
- `rdv.connect(id)` - Join connection by ID
**Connection Events:**
- `connect` - Connection established
- `disconnect` - Connection closed
- `datachannel` - Remote peer created data channel
- `stream` - Remote media stream received
- `error` - Error occurred
**Connection Methods:**
- `conn.dataChannel(label)` - Get or create data channel
- `conn.addStream(stream)` - Add media stream
- `conn.getPeerConnection()` - Get underlying RTCPeerConnection
- `conn.close()` - Close connection
### License
MIT