How does WEBRTC works? Is it possible to implement a demo offline?
Which I need is:
Open two windows on browser, without web server, and send messages between them.
For example:
const localPeer = new RTCPeerConnection();
const offer = localPeer.createOffer();
localPeer.setLocalDescription(offer)
// output offer as TEXT on page
const remotePeer = new RTCPeerConnection();
remotePeer.setRemoteDescription(/* input the TEXT offer here*/);
const answer = await remotePeer.createAnswer()
remotePeer.setLocalDescription(answer)
// output answer on page as TEXT
localPeer.setRemoteDescription(/* input the TEXT answer here */)
const localChannel = localPeer.createDataChannel("test")
const remoteChannel = remotePeer.createDataChannel("test")
localChannel.addEventListener("message", () => {})
remoteChannel.addEventListener("message", () => {})
is it possible?
here is the demo, and it seems doesn’t work.
https://github.com/flowfire/demo-webrtc-001