Pregunta

I want to create a networked embedded device with an HTML5/JS one-page AJAX configuration application.

My problem is: browsers open too much connections nowadays, in my device the number of concurrent connections is maximum 4 with a TCP stack in hardware (please remember, it is an embedded device).

Any request through a socket > 4 seems to be lost, one has to press F5 until a combination of application and cache elements is sitting in the browser.

Now my initial idea was to use a js loader (with the favicon as a data-url) as index document, which in turn loads the rest of the application one by one (perhaps also with progress bar, but that would be luxury).

In theory this should assure that there is only one connection opened at one time.

All js loaders which I found are about parallelizing and making faster in broadband environments on clustered load-balanced webservers, but I need serializing and reliability on a tiny 8bit MCU with webserver.

Any hints or directions are appreciated!

Edit: I have to apologize for using "socket" and "connection" interchangeably, I did mean "connection" and changed the original post accordingly.

¿Fue útil?

Solución

The only way to reliably limit the number of connections a browser makes to your server is by only requiring a single connection to load everything in your page. In other words, everything must be inline.

<!DOCTYPE html>
<html><head><title>MCU app</title>
<link rel="shortcut icon" href="data:...">
<style>
    /* css here */
</style>
<script>
   // JS here
</script>
</head>
<body>

</body>
</html>

Of course, watch out for <img> tags.

The other option I'd consider is hosting your HTML/JS/CSS/etc on a regular web server, and making only API calls to the embedded device.

For example, you'd open mycoolembeddedapp.com in your browser. The app could ask for the embedded device's IP address, and then make AJAX calls to that IP using CORS.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top