Sync data between two offline devices running the same PWA - progressive-web-apps

I developed a PWA that uses the IndexedDB/Service Workers to allow users to work offline. The problem is that different users working offline need to sync the offline data created. In this case one user depends on what the other have created in offline mode.
Is there a way to share IndexedDB between devices ? Is there another approach to send JSON to another offline device ?

Related

Secure, local IoT Device Discovery using PWA without a remote server

I'm looking for a way to managing and controlling IoT devices without the (constant) need for a remote server to be part in it and with a PWA instead of a native application on the managing device. The resulting goal is an IoT device that keeps working when a product eventually goes obsolete (no more server running/allocated) and having an application that has PWA benefits like always up-to-date, easy to replicated and cheaply hosted on something like S3.
As an example, let's say I have one or more IoT devices of different classes like an ESP8266 and a Raspberry Pi for instance. Just as with any new IoT device I want to add it to the network and from there on manage its state from an app. The app in this case is a PWA instead of full blown native app.
1) Traditionally, in the initial setup a native app would scan for wifi networks, connecting automatically to one that has the right name. Using PWA's we are limited to just the "state" of the network. So users would have to manually switch to the network of the newly connected IoT device. This is okay.
2) Next up, the user would need to enter his/her wifi credentials. There might be methods to set this up automatically using a native app, but I don't believe this is the case on a PWA. This, also, is okay.
3) The device then restarts, tries to connect to the network set up in (2). If set up correctly it should get its IP using DHCP. And now things get difficult. I want to 'discover' that network from my PWA. There used to be a way to retrieve the IP from a device using the WebRTC API. but that since has changed to show an obfuscated mdns that resolves to localhost. The ip leak would have allowed for a browser based network scan, but that is no longer possible. I always hoped that Android would default to using a users router as a DNS server, but that is not the case. The result is that simply using an mDNS isn't an option either. I do not want user having to check their router, install an app like fing or do anything else that disrupts the flow from a UX perspective.
Step (3) needs to run every time the app starts so you'd want something reliable. Scanning for devices isn't possible using a PWA, so I need to find another method. I was thinking of something like the way Docker containers can find each other in between networks (see etcd for example), using a predefined key that is shared during installation. The problem with this, is that it requires a remote server to store the IPs attached to that key. I don't want that.
Ideas on how to solve this are very much appreciated! I want to be able to offer a solution that would work even when WAN is out. That being said, I am aware that a connection to a remote server is needed if the end user would want to enable any voice assistant or wants to control a device from WAN.

Using firewall rules to restrict app store access

I'm using OpenWRT and playing with IPtables rules on my router.
I was wondering if there is a way of allowing only certain apps to be downloaded through the Mac App Store or Google Play Store using firewall rules (different app downloads might be indistinguishable).
Anyone knows how the Stores work?
You cannot restrict apps download using IPtable. The Router would need to look into the data packets that are transmitted and this is not possible using IPtables.
The only way you can restrict this is by either blocking app download completly by blocking access to the app store domains or by ensuring that the devices have a policy installed that tells them which apps are allowed to be installed.

Bonjour - one server multiple clients - ios iPhone

Im developing an app where one iOS device act as "server", and other devices are acting like clients.
Im getting hard time with understanding if I can make this using Bonjour
If I make an example:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
All devices have same app installed. All users are connected to the same WIFI.
User must login into app, and when it does, chat rooms are populated from CMS (web server) from internet.
All of them see e.g. all "chat rooms". But at the beginning chat rooms are all read only. Anyone can browse these, but nobody can write into them.
When administrator (user with admin privileges) opens one of the chat rooms; all clients are now able to write into "open" chat rooms.
Of course when one user writes something down, the other users see the newest comment from him.
Administrator should see all clients in chat room but clients cannot see each other.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
All samples which I have found (WiTap, videos from WWDC,...) are using two devices only. I've installed WiTap on 4 devices. And I can establish connection and working "sample" game with two devices.
Can Bonjour service be used in such way that multiple cients are connected to one "server"?
Any hints are very welcome!
Yes, Bonjour can be used like that: for example Apache on Mac OS X has mod_bonjour so that web browsers can find a web server on the local network. That can mean having one server but multiple browsers: exactly the situation you describe.
One limitation is that the way Bonjour is configured in iOS means that the server and clients need to be on the same local network. It doesn't sound like the situation you describe is compatible with using Bonjour in that way, but then I also don't think you need to. You can use the DNS name of your chat server in the app, so any app can discover the server. The server can also be responsible for discovering which clients are connected and allowing people to find each other (indeed, I guess that's what the chat rooms are for).
This is a good place to start. http://mobileorchard.com/tutorial-networking-and-bonjour-on-iphone/ I have build the same Server and client with the help of chatty. But you will face one problem in iOS5 only, when the iphone will go to sleep mode, the socket connection lost. I am not able to solve this problem. So, looking for help. :)

Orb Alternative for playing media on-the-go with mobile devices

I have a collection of legitimate media files (movies, songs, etc) which I have purchased over the years. I used to use Orb (www.orb.com), which would catalog all of the media files on my server, and provide a Flash-based interface so I could then stream my multimedia files to mobile devices, phones, etc, over the internet and watch them while I'm traveling.
Are there any alternatives (preferably open-source) that I can use in place of Orb. I do not trust the company itself, and do not like the idea of having an account with a list of all my media collections stored online. Being a veteran techie and programmer, I prefer to set up my own firewall rules, server configurations, etc, and not have to rely on any sort of credentials being handled by a third party. The only person who should even know of the existence of this server is myself, not some company making money by harvesting data on my and the files on my computer.
The one thing I really liked was the Flash interface, since, between that interface and the others provided, I could play on any device (ie: Playbook, laptop, mobile phone, etc).
Ampache is open source, with a repo on Gitorious.
Ampache is a web based audio/video streaming application and file manager allowing you to access your music & videos from anywhere, using almost any internet enabled device.

Offline cache of data in tablet for a asp.net MVC2 web app

I need to give a survey(an asp.net MVC2 web app) to people on a tablet device. The survey runs on a browser which might suffer from internet outage, hence I need to have the device sync whenever its online. How can I cache data while the device is offline ?
One way of doing this would be with HTML 5 Local Storage.
http://www.kirupa.com/html5/html5_local_storage.htm