Maybe I do not fully understand what is happening inside the XMLHttpRequest, but I have to somehow make a lot of requests without creating a new connection every time. I use a standard set of calls:
function GetFrame(){ var DataRequest = new XMLHttpRequest(); DataRequest.open("POST", "/index.php", true); DataRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); DataRequest.send("Data="+Data); DataRequest.onreadystatechange = function(){ if(DataRequest.readyState === 4){ if(DataRequest.status === 200){ if(DataRequest.responseText.length > 0){ Stream.src = DataRequest.responseText; } } } }; } Everything works, the pictures change (video goes), but if you look at the connections in the firewall, the outgoing ones grow like a snowball . The clients that send these pictures are written on the pluses - hooked by the socket to the server and send the stream without increasing connections, and the web interface where the view is performed accesses the server with AJAX. Tried to render to global var DataRequest = new XMLHttpRequest(); - did not help.
Is it possible to somehow keep the connection open and send as many requests on it using XMLHttpRequest? Or is it necessary to rewrite code on web sockets?
PS: In apache config - KeepAliveTimeout 86400 (day), MaxKeepAliveRequests 0 (unlimited)
DataRequest.setRequestHeader('Connection', 'close')? - Yaant