HTML5 offline webapp communication with Modbus TCP/IP - html

Even if I think it's not possible, I would be sure by asking this to you :
Is it possible to create a webapp (offline/online) to communicate with a machine using Modbus TCP/IP without an external server ?
Here is the point :
We sell machines, which send and receive informations using Modbus TCP/IP, and we would like to create a standalone webapp using pure HTML5 offline cache manifest features that could communicate with them without passing by an external server (except for the first time launch for receiving configurations and save them to localStorage).
I don't think these could be done, but I would be very happy if I'm wrong ;-)
I discovered TooTallNate using Node.js, and I have already used phpmodbus, but these need a server between the device (smartphone or desktop browser) and the machines.
So my question is : is it possible ? And if so, which Javascript library can I use if exists, or where can I find needed informations ?
Thanks in advance for your answer.
Best regards

It is not possible with JavaScript.
Because of security, JavaScript can not access to local resources (Ports, File etc..)

Related

AIR ApplicationUpdater authentication

Is it possible to create an ApplicationUpdater in an AIR app that uses some sort of authentication (perhaps HTTP Basic) to download updates from the server? I want to enable auto-updating in a proprietary application, so it doesn't make sense to upload updates to a publicly accessible web location, since only people who already have the application should be able to get updates.
If I understand this what you wrote the right way you just use XML on your Server which will at start up read out IF OR IF NOT to update just the same way the ADOBE updater works, and with that you can use true / false etc. at least that how I did it with some of my AIR Applications! all can be enforced (visible or invisible) or just by the user done like YES / NO etc. endless options. regards aktell

Know from where the call has been made into the server - Adobe AIR

Is there a way to, server-side, know that an access to the server is being made by an specific Adobe Air app?
I want to deliver some stuff to the app, but I want to be sure that I will deliver to the right app, not anyone hacking and recompiling it.
I think the best way would be to expose to the server the certificate used to sign the app. But how to do that?
All security needs to be done on the server side of things.
Anything done on the client side can and probably will be hacked.
One method you could do is have the server track sessions.
Another would be to encrypt the data back and forth from the server.
Relying on where the app originated is not reliable since all that info can be spoofed.
Have the app log in to the server.
Agree with The_asMan's comment. But if you want, you could load the file:
app:/meta-inf/signatures.xml
That will get you the hash of the swf. Unfortunately, this is useless, cause anyone could just inject that into the urlrequest.

What are my offline and socket options for a modern web application?

So I have been thinking about building quite a complex application. The idea of building an html5 version has become quite an attractive possibility. I have a few questions about it first however.
My first concern is how reliable the offline application API's are at the moment. I have been looking into this standard: http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html and it looks pretty easy to implement and use, but I am wondering how easy it is to use? And assuming you set up the manifest etc, is the web application just accessed (offline) by going to the same url you originally downloaded the application from?
My other concern is the use of sockets. This offline application still needs to be able to communicate with local servers, I ideally wanted to avoid having to host a web-server, a socket connection however would be plausible. How well do websockets currently work when the browser is offline? Is it possible, to have a fully networked / interactive browser application running even without an active internet connection? (after the app is first downloaded)
Any insight would be great!
That's a lot of questions, you may want to consider breaking it up into more easily answerable portions more directly related to what, exactly, you're trying to achieve. In the meantime I'll try to provide a short answer to each of your questions:
My first concern is how reliable the offline application API's are at
the moment.
Fairly reliable, they have been implemented for a number of versions across most major web browsers (except IE).
is the web application just accessed (offline) by going to the same
url you originally downloaded the application from?
Yes. Once the offline app has been cached, the application is served from that cache. No network requests will be made unless you explicitly request URLs from the NETWORK or FALLBACK sections of the manifest or aren't covered by the manifest at all, apart from to check whether the manifest itself has changed.
This offline application still needs to be able to communicate with
local servers, I ideally wanted to avoid having to host a web-server,
a socket connection however would be plausible.
A Web Socket still requires a web server. The initial handshake for a Web Socket is over HTTP. A Web Socket is not the same thing as a socket in TCP/IP.
How well do websockets currently work when the browser is offline?
They won't work at all, when you've set a browser to offline mode it won't make any network requests at all. Note that a browser being set to offline is not the same thing as the offline in 'offline API'. The offline API is primarily concerned with whether or not the server hosting the application can be reached, not whether the the browser is currently connected to a network or whether that network is connected to the internet. If the server goes down then the app is just as 'offline' as if the network cable on the user's computer got unplugged. Have a read through this blog post, in particular the comments. My usual approach to detecting offline status is to set up a pair of files in the FALLBACK section such that you get one when online and the other when offline - request that file with AJAX and see what you get.
Is it possible, to have a fully networked / interactive browser
application running even without an active internet connection?
Yes, but I don't think that means what you think it does. Separate instances of the app running on different browsers on different machines would not be able to communicate with each other without going via the web server. However, there's no requirement that the web server be 'on the internet', it will do just fine sitting on the local network.

Sending and receiving information from an HTML5 page via a serial port

I have to make a HTML5 page to run on a handheld console that communicates information through a RS485 serial port (which is an industrial version of the RS232, if I am right!).
I wonder which programming language can I use to send or receive information from my HTML5 page to the serial port RS485? I look forward to your responses.
If you mean that you want to interface with the Serial Port on the console then you should probably use JavaScript. I'm not sure if any modern browser will allow you to to be honest. If you mean on the server then you could use PHP and use this PHP-Serial Interface.
If you are trying to do it on the device then my only suggestion would be to somehow install a web server on the device again use the PHP-Serial interface.

Offline mode app in a (HTML5) browser possible?

Is it possible to build an application inside in browser? An application means:
1 Where there is connection (online mode) between the browser and an remote application server:
the application runs in typical web-based mode
the application stores necessary data in offline storage, to be used in offline mode (2)
the application sync/push data (captured during offline mode) back to the server when it is resumed from offline mode back to online mode
2 Where there is no connection (offline mode) between the browser and an remote application server:
the application will still run (javascript?)
the application will present data (which is stored offline) to user
the application can accept input from user (and store/append in offline storage)
Is this possible? If the answer is a yes, is there any (Ruby/Python/PHP) framework being built?
Thanks
Yes, that is possible.
You need to write the application in Javascript, and detect somehow whether the browser is in offline mode (simplest is to poll a server once in a while). (Edit: see comments for a better way to detect offline mode)
Make sure that your application consists of only static HTML, Js and CSS files (or set the caching policy manually in your script so that your browser will remember them in offline mode). Updates to the page are done through JS DOM manipulation, not through the server (a framework such as ExtJS http://www.extjs.com will help you here)
For storage, use a module such as PersistJS ( http://github.com/jeremydurham/persist-js ), which uses the local storage of the browser to keep track of data. When connection is restored, synchronize with the server.
You need to pre-cache images and other assets used, otherwse they will be unavailable in offline mode if you didn't use them before.
Again: the bulk of your app needs to be in javascript, a PHP/Ruby/Python framework will help you little if the server is unreachable. The server is probably kept as simple as possible, a REST-like AJAX API to store and load data.
The "Let's Take This Offline" chapter in Mark Pilgrim's (online) book Dive Into HTML5 is a very nice overview of writing offline web apps with HTML5 technologies.
Note: Since Mark Pilgrim's original Dive Into HTML5 link seems to be down.
Copies can now be found here among other places.
Jake Archibald wrote "The offline cookbook". A modern (9 December 2014) and nice approach with ServiceWorker:
http://jakearchibald.com/2014/offline-cookbook/
The answer in 2018 is to leverage the service worker, and to build a Progressive Web App:
https://developers.google.com/web/progressive-web-apps/
i was looking for this also, i found out abt HTML5 Offline Web Apps. havent tried it tho
Users of typical online Web applications are only able to use the applications while they have a connection to the Internet. When they go offline, they can no longer check their e-mail, browse their calendar appointments, or prepare presentations with their online tools. Meanwhile, native applications provide those features: e-mail clients cache folders locally, calendars store their events locally, presentation packages store their data files locally.
Have a look at Google Gears, http://code.google.com/apis/gears/. Although they have been phased out in favour of HTML5. However, it seems that what is being pushed as HTML5 is Google Gears.