Borislav Stanimirov
Borislav Stanimirov

Reputation: 1659

Is WebRTC without createOffer/Answer possible on a local network?

Is it possible to establish a WebRTC connection between two browsers on a local area network without calling createOffer/Answer and instead by manually creating local and remote descriptions?

The browsers are not behind NAT with respect to each other and they have signaled their IP addresses somehow (say via a local HTTP server).

Would it be possible to do something in the spirit of:

const myIp = '192.168.0.1'; 
const peerIp = '192.168.0.2';

const c = new RTCPeerConnection();
c.setLocalDescription(MAGIC_createLocalDescriptionFor(myIp));
c.setRemoteDescription(MAGIC_createRemoteDescriptionFor(peerIp));

Upvotes: 0

Views: 303

Answers (2)

Sean DuBois
Sean DuBois

Reputation: 4252

Yes! If you are using Chrome. Check out offline-browser-communication

You have three points of state you need to deal with.

  • IP/Port. You can setup your network in a way that this is stable. Or attempt to do some guessing?

  • ufrag/pwd. You can set this via SetLocalDescription so you can control these.

  • DTLS Certificate. Use GenerateCertificate this means you will only have to signal it once.

Upvotes: 1

Philipp Hancke
Philipp Hancke

Reputation: 17350

Not in the browser. The offer and answer contain properties such as ice-ufrag, ice-pwd, the DTLS fingerprints and the candidate ports etc that are not static.

Upvotes: 0

Related Questions