Windows 10 reached EOS (end of support) on October 14, 2025. If you are on Windows 10, see this article.

Pesquisar no apoio

Evite burlas no apoio. Nunca iremos solicitar que telefone ou envie uma mensagem de texto para um número de telefone ou que partilhe informações pessoais. Por favor, reporte atividades suspeitas utilizando a opção "Reportar abuso".

Saber mais

Firefox 148: DataChannel send() fails with InvalidStateError after onopen triggers

  • Nenhuma resposta
  • 0 têm este problema
  • 90 visualizações

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?

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?

Deve iniciar a sessão com a sua conta para responder às mensagens. Por favor, comece uma nova pergunta, se ainda não tiver uma conta.