I understand capacitor native app creates a local web server, and the app is a web view showing the content of that web server.
Question 1, when using live reload, the native app webview url can be configured to point to a server within the same LAN network(same wifi). Say if I spin up the dev server on my pc with the network interface exposed, and then point the native app url to that server, then who will be providing the functionalities if I use the plugin @capacitor/filesystem. is it the server running on the pc? or is it still the frontend webview running on the device?(whose files am i trying to accessing here?)
Question 2, is it possible to access the web server running on the native device from outside the device? for example, if i build the app to an android, the app running fine locally on the device, can i access that webview server from the pc?
I don’t really know.
Capacitor itself doesn’t provide live reload, it just allows to be configured to load from a server url, it can be a remote server url or a local server url which provides the live reload functionality.
I think the live reload server uses web sockets to detect changes and reload the url if something changes so the changes appear in the app. But different frameworks use different servers that might work in a different way, so I might be wrong.
Thanks for the explanation.
I think the mechanism is becoming more and more clear to me. I used to think that most of the capacitor plugin functionalities is provided by the web server. Now, after some simple tests, I found out it’s actually implemented in the front end. e.g. I played around with the @capacitor/filesystem plugin. If you spin up a live-reload server on the PC using ionic cap run ..., you will have the app open on the android device specified, you will also be able to access the server from PC browser, and their filesystem will be independent, android will have the actual filesystem on the device, PC browser implementation is actually simulated using IndexedDB. So, I suppose android filesystem functions must be provides by the capacitor wrapper.
Anyway, capacitor is just awesome.