Supports Vaadin card reader USB?

Hello, actually I am using Java Applets for my applications to read a German ID Cards with a USB Card Reader device. I used Vaadin for a little education projects, but now I want to replace my Java Applet application to Vaadin but I don’t know if it works? Has anyone here in the forum experience with USB devices with Vaadin?

Hello Miguel,

I’m no expert on the topic of ID cards and don’t really have a ready-made solution, but maybe I can give you a few pointers in the right direction that might take you there.

With Vaadin, it would be extremely easy to access a USB device connected to the server since everything runs server-side anyways, but unfortunately, in your case, you need access to a USB card reader connected to the client I asume, and here you encounter the same limitations as any other web application, namely a lack of standard API to access USB devices through the browser.

There are two common ways around this:


  • Rely on browser plugins
    : Implement your application in Vaadin as usual, except for the part that actually talks to the USB device. You could write this part as a Java Applet for example and then use the AppletIntegration add-on (Version for Vaadin 6
    here
    and Vaadin 7
    here
    ) to “talk” to the Java Applet from your Vaadin application.

  • Rely on a program installed on the client, providing a local server to talk to via HTTP/WS/…
    : A good example for this is the
    Leap
    controller and browser-based games. It faces the same issue, but the controller comes with a program, that you install and launch locally on the client which in turn starts a webserver listening for local connections. From any web application, you can then just connect to

    http://127.0.0.1:6437

    to retrieve data from the USB device (via the installed application). Talking about German ID cards, the official
    AusweisApp
    in its latest version 2 apparently does the same thing and opens a local server on
    http://127.0.0.1:24727
    that you can talk to from your web application (and apparently even a
    custom URL scheme for mobile
    ). I don’t really know if there are any ready-made Javascript libraries that you could then easily integrate with your Vaadin application or if you would need to do that all from scratch but you can find the technical background on this option
    here
    .

As a third, unlikely option, there’s
direct USB access from the browser
. I haven’t ever used this myself and at first glance, it seems to come with a whole set of caveats and you would also loose any functionality already provided by software like AusweisApp and start implementing at the lowest level, but maybe it’s worth a look.

Let me announce a blog post about the topic.