web: stop double-JSON-encoding the signal payload
Browser was JSON.stringify-ing the inner payload before putting it in the outer message envelope. Go side then saw a JSON string where it expected a JSON object, and SignalPayload Unmarshal silently failed — which is why answers never made it back through the peer connection. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -164,7 +164,7 @@
|
|||||||
type: "signal",
|
type: "signal",
|
||||||
from: peerID,
|
from: peerID,
|
||||||
source: "web",
|
source: "web",
|
||||||
signal: JSON.stringify(payload),
|
signal: payload,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -216,8 +216,8 @@
|
|||||||
try {
|
try {
|
||||||
const m = JSON.parse(ev.data);
|
const m = JSON.parse(ev.data);
|
||||||
if (m.from === peerID) return; // ignore our own
|
if (m.from === peerID) return; // ignore our own
|
||||||
let payload = m.signal;
|
const payload = m.signal;
|
||||||
if (typeof payload === "string") payload = JSON.parse(payload);
|
if (!payload) return;
|
||||||
if (payload.kind === "offer" && payload.sdp) {
|
if (payload.kind === "offer" && payload.sdp) {
|
||||||
handleOffer(payload.sdp.sdp);
|
handleOffer(payload.sdp.sdp);
|
||||||
} else if (payload.kind === "ice" && payload.candidate) {
|
} else if (payload.kind === "ice" && payload.candidate) {
|
||||||
|
|||||||
Reference in New Issue
Block a user