PP.Voice

Set up peer-to-peer voice (and video) calls with built-in WebRTC signaling. PP handles the signaling channel; media flows directly between peers.

Signaling

Use the existing PP connection as the signaling channel. Exchange SDP and ICE candidates through the server without extra infrastructure.

// Initiate a call (client A)
client.voice.call(userBId).then(peerConnection => {
  peerConnection.on('track', (e) => {
    remoteAudio.srcObject = e.streams[0];
  });
});

// Answer (client B)
client.voice.on('incoming', (from, accept) => {
  accept().then(peerConnection => {
    // P2P established
  });
});

P2P Setup

PP.Voice uses WebRTC under the hood. Once the handshake is done, audio/video streams go peer-to-peer for low latency. The server only relays signaling messages.

// Optional: TURN/STUN for NAT traversal
const config = {
  iceServers: [{ urls: 'stun:stun.l.google.com:19302' }]
};
client.voice.setIceServers(config);

For media-heavy non-voice flows, see PP.Media.