Skip to main content

connections

Learn about WebRTC2 connection management and lifecycle.

Connection Types

  • Peer-to-Peer - Direct client connections
  • Server-Mediated - Server-assisted connections
  • Relay - Server-relayed connections

Connection Lifecycle

  1. Initialization - Client setup
  2. Discovery - Peer discovery
  3. Negotiation - Connection establishment
  4. Active - Data/media exchange
  5. Cleanup - Connection termination

Code Example

const connection = await client.createConnection({
target: 'peer-id',
type: 'peer-to-peer'
});

connection.on('connected', () => {
console.log('Connection established');
});

This documentation is under development. More content coming soon.