Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web browser as web server

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 192.168.1.74:2000" (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!

like image 277
brian h Avatar asked Jun 16 '14 17:06

brian h


People also ask

Is browser a web server?

No. Web Browser is a software which is used to browse and display pages available over internet. Web server is a software which provides these documents when requested by web browsers. A web browser sends request to server for web based documents and services.

Is web browser a client or a server?

Microsoft Outlook on your desktop is a software client, and indeed web browsers are software clients.

How does web browser and web server work together?

Web browsers communicate with web servers using the HyperText Transfer Protocol (HTTP). When you click a link on a web page, submit a form, or run a search, the browser sends an HTTP Request to the server.

Why are web server and web browsers are important for a website?

The web server is responsible for connecting websites and web browsers. 4. The web browser acts as an interface between the server and the client and displays a web document to the client. The web server is a software or a system which maintain the web applications, generate response and accept clients data.


2 Answers

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.

like image 161
Mick Avatar answered Oct 02 '22 07:10

Mick


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)
like image 39
Jonas Avatar answered Oct 02 '22 08:10

Jonas