Web browser as web server

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:

  • http://www.peer-server.com
  • https://addons.mozilla.org/en-US/firefox/addon/browser-server/

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:

  • https://developer.mozilla.org/en-US/docs/Web/Guide/API/WebRTC/Peer-to-peer_communications_with_WebRTC

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.


httprelay.io v.s. WebRTC

Pros:

  • Simple to use
  • Fast
  • Supported by all browsers and HTTP clients
  • Can be used with the not stable network
  • Opensource and cross-platform

Cons:

  • Need to run a server instance
  • No data streaming is supported (yet)