I'm trying to build a simple web app that reads the clients' serial port that is connected to a barcode scanner. I have done this using ActiveX but it only works on IE browsers, i have heard that I can now do this using node.js and serial-node. Can someone tell me if this is even possible using these two technologies? Also if anyone can direct me to a working tutorial on how to do this. Thanks!
You can't read the serial port of the web app's client's computer using serial-node, no. Node.js and serial-node run server side, they do not have direct access to the web clients' hardware.
Related
Will I be able to use the raspberry pi with node.js to control something connected to the pi with a website with wifi. And also will it be the same as php or will it have limitations
Yes, definitely !
Without knowing anything specific about what you are trying to achieve, I would say yes, no problem. I do it all the time. For example a simple NodeJs WebServer that serves a webpage, including a WebSocket Server to receive real-time commands or via REST API. Almost anything is possible.
I’m broadly new to vuejs and socket.io and nodejs.
I wrote an single page application to communicate between a nodejs server (running on an Raspberry pi) and a Siemens S7-1500 PLC. Those ones are connected over ethernet and the raspi is getting me an wifi access point for control the PLC with a smartphone, tablet or Desktop.
I’m almost done, but I struggled at that point. I am using socket.io to send events to the client an back. For that i need to know the ip address of my sever inside my vuejs application with is bundled with webpack.
As I get to the point as I was trying to deploy my App onto the Rapberry Pi I didn't found a way to set the IP address dynamically inside my application.
Perhaps some of you guys could open my eyes and give me a Tipp for the solution.
How it's possible to send the IP Address to the client? My Application is running locally and there is no need to do not so.
In my mind it should be possible to send the server ip to the client.
Thank you for your Answers :)
Greetings Denis
You can use linux ifconfig command in order to get your IP from command line of the host application is hosted on. IP is not sth that you set on application level, but ussually is automatically asigned for the given host. So it depends on how your network is set up.
Look for sth like "How to give your Raspberry Pi a Static IP Address".
Since we need to have a UDP socket to discover the device, and since javascript seems not supporting UDP, is it possible to connect to Sony Camera Remote API with a javascript based mobile app (non native).
As said in the comments, you can use Cordova to do the SSDP discovery.
However, as far as I can see, the API is HTTP-based. So if you don't need discover (can write in the IP address and port manually), then this should be possible to do.
Did you ever get anywhere with this project? I'd be interested in getting some LiveView and controlling a camera using Javascript.
I'm looking at the possibility of using a chrome extension or firefox addon that will allow me to read information that is sent over USB in the form of text data? And to the localhost/IP of the machine to certain port?
Can someone point me to the any examples or API documents that will help with my search?
The idea be that the extension is listening for text data on USB or to the localhost of the machine.
Thanks in advance
Additional information:
Can an extension listen to traffic being set over a local IP? on a certain port? Can it be sent to localhost?
Can you listen to data being sent over a USB port?
There is chrome.usb for interacting with USB devices. It is only accessible in Chrome apps however and not extensions.
In Chrome the browser will not provide such access to the system.
The correct way would be to have an external program collecting the data and communicating with the browser add-on. It is achieved through Native Messaging.
Note that you will not be able to bundle the external program with the extension; you'll need to have your own installer.
Edit: I have to comment that #abraham's answer is perhaps more correct. You can have raw USB access in a context of a Packaged App.
I'm trying to access serial port through web browser.
The reason is for downloading firmware to a device that is connected to the same machine that is running the browser (via USB to rs-232).
I'v searched around and have seen that this is doable via Silverlight, but this is Windows only centric since it requires COM support, while my main operating system is Linux, then Windows and then Mac.
I know it's easy to develop JavaFX / QT / Mono / AIR cross platform applications, but those require installing a huge runtime binaries and only then run the application.
I'm trying to keep it really simple, plug your device, visit a web site and it will auto install your application.
Do you guys think it's possible?
Thanks.
https://code.google.com/p/java-simple-serial-connector/
Since Java is cross platform, this would be the only thing required to get the serial support you need in browser.
(not exactly a security nightmare as #"awm" proposed) You could implement a websocket on the localhost, expose a port that is rarely used and call that websocket to open the serial port and feed data to the device to upgrade the firmware.