Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a Progressive Web App work with devices on a local Network?

I have multiple devices on my local network each running a webserver. This web server simply displays a UI to interact with the device. There can be any number of these available and they can be used with multiple different networks. Because of the many possible configurations static IP's probably wont work.

What I have written is some javascript that finds these devices on the local network and returns their IP. Once I have this IP I am using websockets to connect to the server and control it. What I was hoping to develop was a progressive web app that could do this. This is because it would streamline development and mean I only need to make 1 application as apposed to 4 (Windows, MacOS, iOS, Android). However my issue is with HTTP and HTTPS. The PWA will have to be HTTPS while the web servers are HTTP. This means web sockets do not work between the two as it is blocked for mixed content. I am guessing if I want a PWA I will have to find a way to secure the web server on each device. The issue is its not feasible to get a SSL cert for each device and seems silly because they are on the local network.

The web side of things is not my strong suit so I am wondering if there is a way to achieve this or if there is a different route I could take.

like image 705
jdm Avatar asked Jul 16 '19 02:07

jdm


People also ask

Can Progressive Web Apps be installed on mobile devices?

You can use Progressive Web Apps (PWAs) for a fast web experience on your computer or mobile device. You can install the PWA for faster access and additional functionality, like more storage for content to use offline.

Can Progressive Web Apps be used offline?

Our app is caching its resources on install and serving them with fetch from the cache, so it works even if the user is offline.

Do Progressive Web Apps work on desktop?

Progressive web apps can now be installed on Windows, Android, iOS, Chrome OS, and soon on macOS. Is your web app ready? Chrome, the most popular web browser by far, now prompts Windows users to install progressive web apps (PWAs) to their desktop.

Can Progressive Web Apps access the device hardware features?

A PWA can still work when the device is offline. PWAs can be installed on the operating system. PWAs support push notifications and periodic updates. PWAs can access hardware features.


1 Answers

About your question to secure a web server, you will need to provide a certificate for it (if it is for dev purposes you can also generate it by yourself):

There are some solutions that provide already the boilerplate for you:

  • Npm local web server (and they explain step by step how to secure the web server)

  • Here the info to generate a self signed certificate and how to apply it

This should help you with the next steps (correct me if I misunderstood your requirements).

like image 125
Francesco Avatar answered Oct 12 '22 13:10

Francesco