HTML5 supports online web storage which can help in making our website to work offline. But, how can one share data between systems that are connected through LAN when offline?
The requirement is:
If offline, there will be a centralised system, through which all the systems of a particular group will be connected. Any update on one system will be reflected in all the systems in that group. When the centralised system go online, the data will be synced with a remote mysql DB.
And if online, all system will update to the remote mysql DB directly and hence always in sync.
How to get started for such a system?
You can't. This isn't a thing that HTML5 applications can do.
Specifically, there is no way for such an application to "discover" other instances of that application on the network, or to communicate with them, while offline.
Communicating with the "centralized system" you're describing in your question would require your application to be online. And if you're able to do that, the application doesn't need to operate in that fashion anyways!
Related
WebRTC signalling is driving me crazy. My use-case is quite simple: a bidirectional audio intercom between a kiosk and to a control room webapp. Both computers are on the same network. Neither has internet access, all machines have known static IPs.
Everything I read wants me to use STUN/TURN/ICE servers. The acronyms for this is endless, contributing to my migraine but if this were a standard application, I'd just open a port, tell the other client about it (I can do this via the webapp if I need to) and have the other connect.
Can I do this with WebRTC? Without running a dozen signalling servers?
For the sake of examples, how would you connect a browser running on 192.168.0.101 to one running on 192.168.0.102?
STUN/TURN is different from signaling.
STUN/TURN in WebRTC are used to gather ICE candidates. Signaling is used to transmit between these two PCs the session description (offer and answer).
You can use free STUN server (like stun.l.google.com or stun.services.mozilla.org). There are also free TURN servers, but not too many (these are resource expensive). One is numb.vigenie.ca.
Now there's no signaling server, because these are custom and can be done in many ways. Here's an article that I wrote. I ended up using Stomp now on client side and Spring on server side.
I guess you can tamper with SDP and inject the ICE candidates statically, but you'll still need to exchange SDP (and that's dinamycally generated each session) between these two PCs somehow. Even though, taking into account that the configuration will not change, I guess you can exchange it once (through the means of copy-paste :) ), stored it somewhere and use it every time.
If your end-points have static IPs then you can ignore STUN, TURN and ICE, which are just power-tools to drill holes in firewalls. Most people aren't that lucky.
Due to how WebRTC is structured, end-points do need a way to exchange call setup information (SDP) like media ports and key information ahead of time. How you get that information from A to B and back to A, is entirely up to you ("signaling server" is just a fancy word for this), but most people use something like a web socket server, the tic-tac-toe of client-initiated communication.
I think the simplest way to make this work on a private network without an internet connection is to install a basic web socket server on one of the machines.
As an example I recommend the very simple https://github.com/emannion/webrtc-web-socket which worked on my private network without an internet connection.
Follow the instructions to install the web socket server on e.g. 192.168.1.101, then have both end-points connect to 192.168.0.101:1337 with Chrome or Firefox. Share camera on both ends in the basic demo web UI, and hit Connect and you should be good to go.
If you need to do this entirely without any server, then this answer to a related question at least highlights the information you'd need to send across (in a cut'n'paste demo).
I need to build an application for mission work that runs 100% offline and then syncs up with the server when it reconnects to the internet. The application "currently" has over 6k people in the database that needs to be searchable when the missionaries are in the field. The challenge is that I need "all" of the data local and disconnected on multiple laptops or tablets. I know I can use a database like CouchDB but I would much prefer use firebase or something similar to keep the management of the system simple. Is this possible with Firebase?
Thanks!
The web client can handle intermittent offline (will work offline, but won't survive a page refresh), but not persistent offline like the native SDKs can.
If your web app needs specific offline functionality, look into using ServiceWorker and IndexedDB. You can create a persistent offline cache of data for offlne functionality.
Jake Archibald's Offline Cookbook is a great resource for building offline web apps.
I know that MeteorJS is an "isomorphic" web framework, which to my understanding means that code can run on both the client and server in different ways.
However, "server" here means a central server for all clients. If I'm making a quiz webapp, however, I need a central computer (for example to display the questions) to act as the "server" for a bunch of other clients. As in, using the quiz example, in a classroom setting, the student's computers would be clients and the teacher's computer the server.
Is this possible using Meteor? Can I deploy the same app but have it act differently depending on some setting or something?
What you ask for is quite possible. The most common way to achieve it is by using account roles: special privileges for some users. For example, if the teacher logs in (from any computer) the app would display the admin dashboard. alanning:roles is the de facto standard package for this purpose.
You could also possibly implement this by matching the IP address of the browser and the server, too. this.connection will tell you the client IP inside Meteor methods and publications, and Node.js can tell you the server IP. This way you don't need user accounts at all, but then all clients must connect to the teachers computer.
I'd go with account roles, I believe it's more reliable than comparing IP addresses.
I have just used the NotifyIcon class in a windows application and I think it is really handy. I'm predominantly a web developer so I just wanted to find out if there is anything similar to this for a website.
The website I want to incorporate this into has a Ticket Management module where users can capture tickets/problems and then get responses to these tickets from my client's employees who handle the ticket.
Obviously I realize that the notification or pop up will need to be shown in the page, but is there a way to put a timer on the specific page, or even the Master page (maybe javascript or JQuery), to poll the database every few minutes and check for recently modified tickets and let the logged in user know that a ticket has been updated?
Thanks in advance.
If you need the client to keep an open connection to the server and poll it, I think Signal R will be your best bet for integrating into an .NET project. It is on Nuget but source is at https://github.com/SignalR/SignalR.
I would recommend familiarizing yourself with Node.js.
Node.js is a strong tool that aids in leveraging javascript as a real-time server management tool.
After you've gotten yourself familiarized with the Node.js setup, you'll want to grab Socket.io. Socket.io provides suppport for the long-polling technique by leveraging against your websocket created by Node.js. Here, we can manage the conditions at which we serve data. This is a huge tool on the developers side in battling against 2 HTTPD ports.
How can a web application store a very large amount of data client-side? (I'm talking concretely about allowing a capacity of some millions of records).
What I want to do here is to allow research of these records offline.
All of the users are using Chrome.
I was opting for indexedDb until I read that with about 400k records, it is almost unusable.
Then there is the Web SQL, but it had been deprecated.
I was then thinking that my last option would be to install a web server like apache with small script locally that would interact with my web application and store the records in a DB like MySQL. With AJAX I could access my script in localhost, but then there is the cross-domain problem.
I ran out of ideas
Update: clarification->
The main web application is running on a distant server. It has to be on a server as the application is used by several people at different locations (it is shared), and need to be accessed by smartphone, etc. The last idea was to install a web application locally (on all of the user's computer), that would interact with that distant web application to fetch the records from it and store them locally. Anyway it wouldn't work because of cross-domain issues I guess.
I see few alternatives:
don't you actually need a desktop application. I know, I know it is so 1990's...
installing a local web server and accessing your application via web browser is an option as well. But this is dangerously close to point 1.
you might consider developing a Java applet and permitting it to use the file system