Accessing serial devices connected to local machine from Web application

Is there a way to access serial devices connected to local machines from browser through web application that is deployed on XOJO Cloud?

Web browsers cannot access the serial port. You must deploy a desktop application and send the data to your server if you wish to access serial port.

Is it not possible using Java script or chrome extensions?

I don’t believe extensions support serial port access.

Can you suggest a way to print label from Web application.?

Can you explain it ?

You want to present a mailing label to a browser and have them print it?

See Xojo documentation on SerialPort. Build a desktop app to read SerialPort data. Send that data to web server. Web server does something with it, perhaps replies with a response? Desktop app gets response from web server. Desktop app sends response to serial port.

Sure its possible - not typical though. Knowing more about your use case and why you believe you need to access local serial port from centralized location would be useful.

We have to make web application so that it print at the client side

Printing is a much different beast than accessing the serial port directly. Given that the client has installed a printer on the serial port, you just display a print-worthy page and have the client print it to whatever device they want. We use that to print inventory labels on a zebra printer. (Not from Xojo, it’s pure html/css, but you should be able to accomplish that with Xojo as well.)

Is it possible in XOJO to communicate to the device at client side?


It can only be done with browser plugins, or local software on the client machine. But you may be able to create a console or desktop software that people can download, then communicates with your xojo web app.

you can create service app as server side app and then create client app which will connect to that server app on same server where you are hosting and web and port based device. for data exchange between this two apps (server and client ones) you can use TCP or UDP data sending - some sort of making web server app which actually in your case will be device server and clients would be web client sessions.

Keep in mind that at same time you can use only one device per web session so if there are few different web sessions which comes and request printing or data gather from device then one of it must be on hold and wait!

Using PHP

So it is not even possible with Java applet/java script or chrome extension in XOJO?

You can use JAVA as server side scripting but also that depends on your web server side which your holding.

You can make chrome extension also but you need to make some code or lib or app which will have user privileges and direct access to device over port which can be com, usb, ethernet or any other port BUT on server side over which you want to send/receive data and then broadcast to remote and/or web site.

You can do even with Xojo - as far as I noticed:

This comes if your solution should allow any remote and/or web client to talk to device which is connected on server side!

If you want to make web interface and give user a access to do on his local machine then first you need to install low level api/lib on his machine which will be a bridge to your web interface. For example making a java applet which will be drop on client side and the start interact with it over web browser.

You might be able to do this with a Java Applet. If you need to write a custom interface to it in JavaScript, you can do that with the WebSDK. See the documentation in the extras folder.

NOTE: it’s important to remember that Java<>JavaScript.

[quote=359432:@devyani gaikwad]Can you suggest a way to print label from Web application.?

Can you explain it ?[/quote]

I did this oooo, probably almost 20 years ago now for a dotcom. I was developing a customer checkout system for their retail stores and as I had control over the hardware and OS I just made an ActiveX control that was shown in the last “Thank You” page which did the printing. I could then generate the label on the web server and send the data through to the thank you page that went through the activex control and to the printer. Super simple but it worked perfectly. I’m not saying that would be the best way to go it these days, just giving the example :slight_smile:

There’s a few ways to accomplish this. So many questions need to be asked/answered to provide an answer to this.

Do you have control over the hardware at the client end?
What platform will that be? W/Mac/Linux/Mobile?
Can you pre-install software on the hardware?
Will it be for general public use or for employees of the company?

We do not have control over hardware

It can be any platform but mostly it will Mac and Win

We cannot preinstall any software on client side

It will be for employees of the company

Chrome is shutting down their app support (for win/mac/linux) in early 2018 so there is no point using that (it could have been done in that)

A java applet would need a JRE to be preinstalled, so you cant do that.

IE11 can do it with activex still but you’d need to download and install the control so that isnt an option (and it wouldnt be much good on mac)

The whole point of a browser is that its sandboxed from the machine, unless you pre-install something this will not be possible.

If you could install a program on the machine you could do it many ways but one way you could do it really simply in Xojo, just provide a program that wraps up a browser control, detects when it gets to a certain page that needs printing support, then get the data out of the html source and fire it off to the printer.

Technically, as long as the receipt printer could act as a standard printer (which most can do through the right setting) you could also do it in raw html and css but it would involve the user selecting the correct printer when the print dialog is opened.

Do you mean by desktop or console application?
How can it be done can you please refer any example code of some sort?

If you don’t want to install anything on the clients computer, why does a console application peak your interest?

If you are ok with doing it via a console application I’d use a different method anyway.