Web browser as web server

| | August 5, 2015

Sorry if this is a dumb question that’s already been asked, but I don’t even know what terms to best search for.

I have a situation where a cloud app would deliver a SPA (single page app) to a client web browser. Multiple clients would connect at once and would all work within the same network. An example would be an app a business uses to work together – all within the same physical space (all on the same network).

A concern is that the internet connection could be spotty. I know I can store the client changes locally and then push them all to the server once the connection is restored. The problem, however, is that some of the clients (display systems) will need to show up-to-date data from other clients (mobile input systems). If the internet goes down for a minute or two it would be unacceptable.

My current line of thinking is that the local network would need some kind of “ThinServer” that all the clients would connect to. This ThinServer would then work as a proxy for the main cloud server. If the internet breaks then the ThinServer would take over the job of syncing data. Since all the clients would be full SPAs the only thing moving around would be the data – so the ThinServer would really just need to sync DB info (it probably wouldn’t need to host the full SPA – though, that wouldn’t be a bad thing).

However, a full dedicated server is obviously a big hurdle for most companies to setup.

So the question is, is there any kind of tech that would allow a web page to act as a web server? Could a business be instructed to go to thinserver.coolapp.com in a browser on any one of their machines? This “webpage” would then say, “All clients in this network should connect to″ (which would be the IP:port of the machine running this page). All the clients would then connect to this new “server” and that server would act as a data coordinator if the internet ever went down.

In other words, I really don’t like the idea of a complicated server setup. A simple URL to start the service would be all that is needed.

I suppose the only option might have to be a binary program that would need to be installed? It’s not an ideal solution – but perhaps the only one? If so, are their any programs out there that are single click web servers? I’ve tried MAMP, LAMP, etc, but all of them are designed for the developer. Any others that are more streamlined?

Thanks for any ideas!

One Response to “Web browser as web server”

  1. There are a couple of fundamental ways you can approach this. The first is to host a server in a browser as you suggest. Some example projects:

    Another is to use WebRTC peer to peer communication to allow the browsers share information between each other (you could have them all share date or have one act as a ‘master’ etc deepening not he architecture you wanted). Its likely not going to be that different under the skin, but your application design may be better suited to a more ‘peer to peer’ model or a more ‘client server’ one depending on what you need. An example ‘peer to peer’ project:

    I have not used any of the above personally but I would say, from using similar browser extension mechanisms in the past, that you need to check the browser requirements before you decide if they can do what you want. The top one above is Chrome based (I believe) and the second one is Firefox. The peer to peer one contains a list of compatible browser functions, but is effectively Firefox and Chrome based also (see the table in the link). If you are in an environment where you can dictate the browser type and plugins etc then this may be ok for you.

    The concept is definitely very interesting (peer to peer web servers) and it is great if you have the time to explore it. However, if you have an immediate business requirement, it might be that a simple on site server based approach may actually be more reliable, support a wider variety of browser and actually be easier to maintain (as the skills required are quite commonly available).

    BTW, I should have said – ‘WebRTC’ is probably a good search term for you, in answer to the first line of your question.

Leave a Reply