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",
|
||||
from: peerID,
|
||||
source: "web",
|
||||
signal: JSON.stringify(payload),
|
||||
signal: payload,
|
||||
}),
|
||||
});
|
||||
}
|
||||
@@ -216,8 +216,8 @@
|
||||
try {
|
||||
const m = JSON.parse(ev.data);
|
||||
if (m.from === peerID) return; // ignore our own
|
||||
let payload = m.signal;
|
||||
if (typeof payload === "string") payload = JSON.parse(payload);
|
||||
const payload = m.signal;
|
||||
if (!payload) return;
|
||||
if (payload.kind === "offer" && payload.sdp) {
|
||||
handleOffer(payload.sdp.sdp);
|
||||
} else if (payload.kind === "ice" && payload.candidate) {
|
||||
|
||||
Reference in New Issue
Block a user