auto restart
All checks were successful
Plant Growing Automation / deploy (push) Successful in 6s

This commit is contained in:
David Westgate 2025-04-25 21:44:07 -07:00
parent 8a22a15f86
commit 41dfe61afd

View File

@ -65,12 +65,23 @@ dataChannel.onclose = () => {
console.log("📴 Client: Data channel closed");
};
const restartIce = (pc, ws) => {
setInterval(async () => {
const offer = await pc.createOffer({ iceRestart: true });
await pc.setLocalDescription(offer);
ws.send(JSON.stringify({ type: 'offer', data: offer }));
}, 50000)
}
ws0.onopen = async () => {
pc0.addTransceiver('video', { direction: 'recvonly' });
pc0.addTransceiver('audio', { direction: 'recvonly' })
const offer = await pc0.createOffer();
await pc0.setLocalDescription(offer);
ws0.send(JSON.stringify({ type: 'offer', data: offer }));
if (isSecure) {
restartIce(pc0,ws0);
}
}
ws0.onmessage = async (message) => {