HTML5 Websockets - will this allow me to communicate with host machine? - html

I want my web application to communicate with a serial device on a host machine (e.g. a card reader). I don't want to use the ActiveX/COM route. Is there something in HTML5 websockets that could help me?

Complete code example for a serial-to-WebSocket gateway is here:
https://github.com/oberstet/Autobahn/tree/master/demo/serial2ws
This is based on Autobahn WebSockets .. and is possible because Autobahn is based on Twisted, and Twisted has support for serial, XMPP, ... many things.
Disclaimer: I'm author of Autobahn.

Yes, Web Sockets could help.
Take a look at this, it is using web sockets for a micro-controller: http://blaisejarrett.com/websockets/

Related

WebRTC browser-to-browser

I am trying to use WebRTC to implement browser to browser communication.
I want to allow communication between two browsers running on two different computers in the same LAN.
Can somebody confirm is this possible and if so, how.
I tried looking up the demos and seems they all have examples for application running in the same page. But I would like to connect to a peer computer using some IP address.
Regards
I have just solved your problem using https://github.com/feross/simple-peer
Yes, it is possible to create a Peer to pear connection using PEERJS. PeerJS simplifies WebRTC peer-to-peer data, video. PeerJS wraps the browser's WebRTC implementation to provide a complete, configurable, and easy-to-use peer-to-peer connection API within a LAN Network. PEERJS

Embedded webserver HTML5 mobile app approach

I'm planning to realize the following project and would be thankful if somebody could verfy my approach!
I want to establish a fully bidirectional wireless realtime communication between a smartphone (cross platform) and a embedded microcontroller running a webserver.
The webserver should provide data of the connected hardware in realtime e.g. temerature.
The smartphone should render these on screen and you should be able to configure the hardware e.g led color with the smartphone and save the config to the embedded webserver.
My first guess was to use HTML5 websockets but they aren't available on all platforms so I got inspired by XBMC, which uses JSON-RPC.
Just imagine a car stero system with bluetooth connected to a µC with webserver and wifi dongle.
My plan is to implement a webapp on the webserver which lets serves the purpose mentioned above. But the tricky part is to get the user to establish a bluetooth connection to the stereosystem because i looked up similar questions which say you can't access stuff like bluetooth on the smartphone with HTML5.
long story short, this is the current idea:
hardware -> µC -> webserver -> HTML5 Webapp-> WIFI -> Smartphone
communication via JSON RCP.
I would be highly thankful if somesone could give a statement to said idea and planned implementation because I never done this before!
Thanks guys!
We at muzzley, have developed a framework to simplify this process. We provide a way for your browser applications to communicate with smartphones. In the side of the smartphone you have widgets that are already done (gamepad, drawpad, switch, swipe, others) or you can build your own html based widget.
(disclaimer: i work for this project)
Most of the work is already done for what you want to do :)
Quick start here:
http://www.muzzley.com/documentation/quick-start.html
You can pull from github several examples here:
https://github.com/muzzley/muzzley-demos/
Lib for browser:
http://www.muzzley.com/documentation/libraries/javascript.html
I hope it helps.
Best
I think your first instinct was probably right. Have you looked at socket.io for node? It's essentially a shiv which ensures that you can use websocket functionality in virtually any combination of device and browser (see list of supported transport mechanisms and browsers here).
It should allow you to avoid bluetooth altogether.

HTML5 offline webapp communication with Modbus TCP/IP

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..)

How to get MAC address client side with js,flash,java or etc. with crossbrowser method

How can I get the MAC address (or something unique for each pc -at least standard user knowledge level-) from client side with js,flash,java or etc. using a crossbrowser method?
You probably know when we are coding a poll we should use cookies to prevent multiple voting.
I couldn't find a crossbrowser javascript method (without MS IEs activex). Javascript, java applet or flash files will be welcome.
Thank you
Caglar
There are no standard Javascript APIs for getting a mac address.
It is possible to get this information using a Java applet, but it would need to be signed and have a policy file in order to access hardware info, and it wouldn't really be transparent to the user. See Getting MAC address on a web page using a Java applet
If you just need to track a client, the most reliable thing you can do is use a combination of APIs available to Javascript to create a persistent cookie. It's possible to create a very resilient cookie using a combination of standard HTTP cookies, session storage APIs, caching tricks, and plugins. Evercookie is a great example: http://samy.pl/evercookie/
You can't do that with JavaScript. Otherwise any one can lure you to visit their website will be able to peek your MAC address, and that would be a security issue. You can only do it through plug-ins. And the browser will have to prompt user to explicitly allow that plugin first.

Does HTML5 Support Peer-to-Peer (and not just WebSockets)

The language I am working in is Javascript on HTML5-compatible browsers.
My understanding is that WebSockets require a socket server to transport push notifications and messages back and forth between clients.
Is there an actual peer-to-peer capability with HTML5 that does not require a socket server? Has anyone seen example client-side code in Javascript that exemplifies this capability?
See the answers for Will HTML5 allow web apps to make peer-to-peer HTTP connections? However, the content in the WebSockets specification seems to have gone, so I suspect the answer now is "no".
WebRTC
http://www.webrtc.org/
https://developer.mozilla.org/en-US/docs/Web/Guide/API/WebRTC
But in 2010 it wasn’t a thing :(
https://www.peer5.com/faq
Just seen this online, may be worth looking at.
Most of the time browsers are behind firewall and you cannot connect directly to browser. If you don't want to implement server yourself there is a solution:
https://httprelay.io/
You can use AJAX calls to communicate between browsers.