Looking for a way to surpass the 6 http limit connection imposed by Chromium

194 Views Asked by At

I'm developing an app in electron. It's main purpose is to show a better GUI for ZoneMinder.

I'm using the API, and other stuff to access data, problem is, livestreams have a method using direct access to the cgi and, when you have more than 6 streams opened, the next one will fail.

I want to have like a main video stream(with the selected monitor) and under it, mini video screens with previews of the other monitors on the same group.

I tried many formulas, look for any solution anywhere, etc. with no luck.

Part of the code that draws the main monitor img is:

   var zm_main_img = new Image();
    zm_main_img.setAttribute('class', 'video-main app-draggable');
    var zm_img_src = zm_url_base + "/cgi-bin/nph-zms?scale=100&width=" + main_width + "px&height=" + main_height + "px&mode=jpeg&maxfps=" + zm_fpsm + "&monitor=" + monitor + "&token=" + zm_token + "&connkey=" + zm_connkey;
    zm_main_img.src = zm_img_src;
    zm_main_img.setAttribute('id', 'v_main_x');
    video_main.appendChild(zm_main_img);

Take note that the streams are mjpeg. When I tried to use "simple" mode, i.e. just one image (no mjpeg), it works, but... no video feed at all as expected. I've also tried to check if the subvideo feeds are loaded to reload the src again, but I'm having serious problems because I must have this to be set as dynamic content (some groups have different qty of monitors).

When I'm using the code inspector, I can see the multiple connections opened and after the 6th one I can see many on "Pending". After hours complaining about this I found that it's a limitation imposed by Chrome (and many other browsers). Then thing is:

  1. Is there any way to kill the already opened streams when I don't want to use them?
  2. If not, what could be the best way to accomplish what I want? I mean, be able to open multiple img without worrying about this?

Here's the link to the repo, if you want to collaborate or help.

Thanks in advance!

0

There are 0 best solutions below