Creating a web server using the chrome.socket API

I created a web server using Chrome Packaged apps. The problem that I see repeatedly is that chrome.socket.accept () and chrome.socket.write () do not call the callback function. It usually works more or less reliably if the request speed is less than 1 request per second. If I go above this, I will start to see errors or missing callbacks.

I did similar tests with the Google webserver sample application ( https://github.com/GoogleChrome/chrome-app-samples/tree/master/webserver ). This problem has the same problem. Typically, a web server takes less than 100 requests before the web server stops responding. The easiest way to reproduce the problem is to use the Chrome browser as a client and hold the F5 key for a few seconds.

It would be advisable to have a sample application demonstrating how to create a reliable web server using chrome.socket. So far, I have tried several different workarounds to monitor the situation from the application itself and restart the socket when the socket stops working, but this is not easy, because there is no reliable way to check the connection status or the status of the last operation when the callback is not fired. I tried using the getInfo () method, but it always returns "connected = true" regardless of the situation.

I saw this on Windows 7 and Chrome OS (Chromebook).

+3
source share
2 answers

Just update it. According to this , the problem is now fixed.

+1
+1

Source: https://habr.com/ru/post/1671422/


All Articles