WebRTC DataChannel worked perfectly in Firefox 147 and earlier, but after upgrading to Firefox 148, send() throws InvalidStateError immediately after onopen fires. Same c… (read more)
WebRTC DataChannel worked perfectly in Firefox 147 and earlier, but after upgrading to Firefox 148, send() throws InvalidStateError immediately after onopen fires. Same code works in Chrome and previous Firefox versions.
const dataChannel = pc.createDataChannel('kvsDataChannel', {
ordered: true,
maxPacketLifeTime: 3000
});
dataChannel.onopen = () => {
console.log('open, state:', dataChannel.readyState); // Shows "open"
try {
dataChannel.send('hello'); // Throws InvalidStateError
} catch (e) {
console.error('Failed:', e.name, e.message);
}
};
Error: InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable
Environment:
Firefox 148.0: Fails
OS: Windows 11
Firefox 147 and earlier: Works
Question:
What changed in Firefox 148 that broke DataChannel send()? Any workaround while this gets fixed?