fix: stops working after 500 connections in Chromium
Restarting the browser (or reloading the extension) helps.
Apparently in Chromium there's a limit of 500 on how many RTCPeerConnection
s you can create. Closing or GCing them doesn't help.
let i;
for (i = 0; i < 10000; i++) {
(new RTCPeerConnection()).close()
}
Uncaught DOMException: Failed to construct 'RTCPeerConnection': Cannot create so many PeerConnections
i
499
Guess we'll need to reuse old connections, or get this limit bumped.
Need to consider not creating a RTCPeerConnection
before each poll, or better yet not discarding it if the poll doesn't return a client.
A hack that could work: call (browser|chrome).runtime.reload()
Related: #72
Edited by WofWca