5,337
edits
Line 38: | Line 38: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Next the local and remote clients exchange descriptions: | |||
<syntaxhighlight lang="javascript"> | |||
const localOffer = await localConnection.createOffer(); | |||
localConnection.setLocalDescription(localOffer); | |||
signallingChannel.send(localConnection.localDescription) | |||
# On the remote | |||
const localOffer = signalingChannel.receiveAnswer(); // Actually a callback irl | |||
remoteConnection.setRemoteDescription(localOffer); | |||
const answer = await remoteConnection.createAnswer(); | |||
remoteConnection.setLocalDescription(answer); | |||
signallingChannel.send(remoteConnection.localDescription) | |||
# On the local | |||
const remoteDescription = signalingChannel.receiveAnswer(); | |||
localConnection.setRemoteDescription(remoteDescription); | |||
</syntaxhighlight> | |||