Jump to content
uniGUI Discussion Forums
herculanojs

Communication Peripherals Client

Recommended Posts

Does anyone have any component, or do you know any practical resources for communicating with peripherals on client stations.

The big problem we face, and there are numerous posts in this regard are related to interaction with peripherals in the client.

Printers, scales, digital scanners, etc.

 

The portability for web applications has been occurring, however what is the solution to these questions?

Share this post


Link to post
Share on other sites

I use a local service on the client computer,

which runs a webserver, and the unigui app

has an http client which calls that webserver

sending an event ID.

 

The service then uses this ID to get the event

from the event table and prints and opens

the cash drawer, and stores the new event

status in the db.

 

So the service runs a webserver and has

a db connection, and that works, only need

to set NAT on the router on the port used.

 

I am considering using a TCP connection

instead, with a TCP client at the local PC,

and a TCP server at the windows server,

and a TCP client in the unigui app, to get

a system where the initial connection is

outbound, so I do not have to do the NAT.

 

There are only two ways: either you connect

from the outside, either to a process/service

or the hardware directly, or you connect from

the inside, outbound, and do TCP or websocket

or http long polling, from a process/service.

Share this post


Link to post
Share on other sites

Hi guys,

 

I see this question everywhere, not only in this forum.

A desktop application has full access to the local resources (depending on the user rights, of course), while a web application runs in a sandbox inside the browser. It is not possible to access local resources without creating a huge security risk and it is necessary to find other ways for executing some previous tasks.

 

Let's use a practical example to make things clear.

 

Imagine that you want to implement an Access Control Security System hosted in the cloud. It is the kind of system where the users identify themselves at secure doors using proximity cards or biometrics like their fingerprint.

At some point, each user will have to be enrolled in the system, a reader will have to scan the fingerprint or read the proximity card number.

Sometimes you can use special-purpose readers which you can attach to a PC USB port. In other cases, you can only access the readers through the network.

In any case, if the web application is enrolling one user, we want to enter the personal information and link that person (the cardholder) to some specific proximity card or to his/her own fingerprint.

So, you will want to press a button "Read Card Number", swap or tap the reader with the card, and show the card number on your form.

 

The local desktop application will directly read from the USB port and get the card number.

The web application requires something different.

 

Basically, all these "integrations" will happen server-side. If you need to read proximity cards in the enrolling stations, you will create a Windows Service which will be running in the background connected to the back-end server through a web service. By polling that server, the service will know when it needs to read a card, it will wait for the swipe or tap, get the number from the USB/COM port, and send it to the server.

The web application will also have a timer which will refresh its data looking for the card number stored in the database.

 

This kind of application, the Windows Service running on the local PC, and the web service hosted on the server and connected to the common, central database, is easily done using products like RemObjects SDK or just plain Indy (TCP or UDP).

 

Just remember that the client PC connects to the remote server through several security layers, firewalls, routers, etc. It is easy to reach out, but it could be impossible to get in. You can always ask for something and receive a response, creating a two-way communication channel which will always start with the client, never with the server.

Share this post


Link to post
Share on other sites

This is a classical problem due to the architecture, as the local machine is behind a firewall,

difficult to approach.

 

So the best solution is to not approach it.

 

If you use the postbox method, the local service may poll a central db constantly,

and this is outbound creating no problems.

 

Except for network traffic - polling each second is not recommended.

 

But if we can predict when the need comes, from user behaviour, we can reduce

the polling frequency, to maybe once a minute, and then increase it for a while,

expecting something to happen.

 

Inbound is not good, and two live TCP connections and a TCP server is complex,

even if outbound, and a websocket client would not solve this either, really.

 

Variable frequency intelligent polling based on user behaviour predictions...

Share this post


Link to post
Share on other sites

I am talking outbound, and then you cannot use long polling

without having an extra server on the host side, as the client

is then local.

 

Websockets - well only if you have a JS websocket server then, running

in the browser, as for outbound you must have the client local.

Websockets are basically TCP at the core, so the client-server model

is still there.

 

I do not want an extra server, as stability is all about reducing complexity.

Share this post


Link to post
Share on other sites
What I have noticed is that migrating applications to the clouds is still something that needs more maturing technologies, especially in the case of interaction with hardware. We have to make many ganbiarras just to make an impression.
Imagine more complex things like integration with electronic ratchets, electronic point, etc. You can forget.
 
I think I will abandon the project in unigui and return to firemonkey or vcl.
 
As it is said: Our customers do not want to know what technology we use, they want to know that the thing works efficiently.

 

And I have been facing great problems with the interaction with periphery.
 
I have tried numerous approaches, and in all cases there is always some laughter when put to the test.

Share this post


Link to post
Share on other sites

this is something that also bothers me, but I would like to know why some external devices are accessible by the web and others not, like the webcam we already have mechanisms in the unigui to do this, and also of biometric readers, I still have not found anything about it in unigui, but I have already seen several web systems that access the biometric reader without the use of external gambiarras. an example and the own "maker" of softwell here of brazil, that already comes with this of native form for the user login.

Share this post


Link to post
Share on other sites
For more than 1 year I have debated this here in the forum, but without significant advances. I have to deal with many peripherals on clients, and today I have had too many problems.

To just print I have to put the unigui service to upload with user with aministrador privileges. Turn and move to stop working, and you have to go there and restart the service.

 

To access a balance, a biometric reader, I had to make a client stay running at the local station and exchange messages via the websocket. However, this is costly, not practical.

 

I'm analyzing the go-global/graphon virtualization solution. At least usb peripherals you have access as well as printers.

Share this post


Link to post
Share on other sites

As I mentioned before, there are many web applications communicating with local or remote hardware by using a central server and local services.

Most of the modern Security Systems migrated or are migrating to the cloud without losing features.

 

David

Share this post


Link to post
Share on other sites
Everything I've discussed here in relation to peripherals comes up against the issue of browser security. I've heard of inconvess: impossible here.

Direct printing on equipment is the greatest gymnastics. Interassion with ratchets, bluetooth, etc. At least here the suggestions are communications through local services in the client interacting with the server (which will run into a series of issues of network security topology, firewall, proxy, etc.) which makes it unfeasible.

I honestly still could not find or have an answer to something that is really plausible.

Share this post


Link to post
Share on other sites

Oliver Morsch is right, it is working nicely with long polling on the Unigui server,

and then the connection will be outbound and no router/NAT issues at all.

 

Attached is a simple setup illustrating this. Then it is all about making the

local service run without a hitch - and that is not a Unigui problem :)

 

I will also propose a namechange:

 

 - Uniguni

 

UNIque Graphical User Networking Interface.

 

A little tounge in cheek, of course, but also the chance to launch

a press release and define a new term - everybody loves terms.

 

Besides, it is easier to say...and can by time expand to UniGuniLuni,

or whatever...the sky is the limit ! :)

post-980-0-21978200-1525815280_thumb.png

polling.zip

Share this post


Link to post
Share on other sites

 

For more than 1 year I have debated this here in the forum, but without significant advances. I have to deal with many peripherals on clients, and today I have had too many problems.
To just print I have to put the unigui service to upload with user with aministrador privileges. Turn and move to stop working, and you have to go there and restart the service.
 
To access a balance, a biometric reader, I had to make a client stay running at the local station and exchange messages via the websocket. However, this is costly, not practical.
 
I'm analyzing the go-global/graphon virtualization solution. At least usb peripherals you have access as well as printers.

 

---------------------

 

I need this too ... and I can not find a way to solve it.

Share this post


Link to post
Share on other sites
Hi
 
This is a general issue/behavior of web application. ...the use/support of local hardware. I have the same issue for the use of a NFC reader/writer during a festival
Would be great if there will be more en better support for using local hardware. One of the advantage of web or SAAS application would be no installions
on a local machine. For now i don't think you can't avoid it to install some agent on the users machine to use the local hardware.
 
For now...i'm developing my new Event Management System in uniGui BUT there will be a 'back-office' Windows application where the printing
and nfc reading/writing will be done during a festival.
 
I even thought about the application completely in Windwos and make it available as a remote app. That is what we have done now and with the existing
Windows application and I can do everything:
- use FastReport designer (also a BIG loss)
- use barcode readers
- use nfc readers / writers

Share this post


Link to post
Share on other sites

I had to give up long polling, as the indy http client was too unstable

due to the apache server being nightly restarted. 

 

So I had to use cross-origin scripting through the browser to access

a local webserver running in a service, and do all processing in

separate small applications, to make this 100% stable.

 

So to push stuff to the local computer is not a problem.

 

But to initiate a process from the local computer is harder

as you want to affect the running client session, so I am going

to set up another solution.

 

For example, for product scanning, I will make the local scanner

which is controlled by the service application and connected to the db

post the product into a table at the server, and use a timer to check

this table when the appointment window where you add products

is opened. Only then the timer runs, and fetches the scanned products.

 

Another way is to use websockets, but to emit it without having

a local node server...maybe I can call up Explorer as a COM object

and run the socket emit code minimized. Have not tried that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×