WebUSB detect if web page is being opened - usb

I am looking for some mechanism that would switch USB device to failsoft mode when connection to the site is broken (i.e. browser crashed, user closed tab with the site that communicates to the device or simply network connection is down).
One of the option I can see is some kind of mechanism of sending keep-alives from browser to the device - unfortunately the only (simple) way of transferring data from browser I found is via CDC (which is using bulk transfer - that the slowest way of sending data). Is there any way to utilize interrupt transfer via WebUSB? Or maybe there is a better way than sending keep-alives to achieve desired behavior?
Currently I am focused on Windows 10.

What you want to do is set up your interface with two alternate settings. Alternate setting 0 can be the failsafe mode and is selected by default. When your app opens the device it can call selectAlternateInterface() to select alternate setting 1 which would be your active mode. The OS will automatically send a SET_ALTERNATE(0) command to your interface when you call close(), the page is closed, or the browser crashes.

Related

Is it possible to receive MT4 alerts in code-readable form (E.g. webhook, API call, file etc) instead of as a push notification?

I'll be using a 3rd party MT4 EA or Indicator which can send push notifications or display an alert on the MT4 desktop screen. Is there a way to access these alerts somehow in code that I have running on a standard web server (for example by my code somehow receiving the push notification instead of my phone), or alternatively running e.g. in Python or whatever on the same VPS (or physical PC) that I have MT4 terminal running on, and reading the filesystem (if alerts are written there?) or communicating with the MT$ process somehow?
Thanks

Why does my virtual machine stop conducting blueprism automated processes when I minimize or close it?

I automate processes on a remote computer. When I start a process from the control room, that works totally fine. But as soon as I minimize or close the remote computer (I don't shut it down, I just close the window), the remote computer crashes. The log contains entries like that elements cannot be found. The reason is, that the remote computer does not even open the applications.
So, what's the reason for that? The computers state is on desktop, so there is no screensaver or logon screen.
Expected result: The robot should work finely even when the remote desktop session is not on screen, like in production environment.
You haven't specified, but the below answer extrapolates your statements regarding how you've "[minimized] or [closed]" your "remote computer" to assume you're leveraging Microsoft's Remote Desktop Connection utility/protocol.
Blue Prism specifically discourages the use of Remote Desktop to manipulate remote Runtime Resources within a Blue Prism-based environment, as the use of the protocol itself causes the methodologies Blue Prism uses to locate elements in the Windows desktop environment to stop working entirely. This is explicitly spelled out in Blue Prism's official documentation on Remote Access Tools:
The following tools have been deemed to be specifically unsuitable for
providing remote access to Blue Prism environments:
Remote Desktop Connection (RDP)
The way that this Windows tool (and other tools that
use the RDP protocol) handle session management is not compatible with
Blue Prism:
The underlying operating system is aware as a connection is established which can, subject to the automation techniques being
applied, result in the executing automation being interupted.
It requires the remote access credentials to be aligned with the credentials used to authenticate the target system against the network
which presents a potential security risk.
As a user authenticates any previously connected users are locked out.
Each connection creates a separate desktop session.
The connection is not maintained throughout a system reboot.

Browser based document scanning

I am building a browser based application for document scanning. I have looked at offerings from multiple providers like dynamosoft, asprise, atalasoft etc. My basic question on browser based document scanning is that does any of these products enable scanning from remote machines, using browser based interface? Or should scanner be always connected to the system from where browser is launched?
Yes. Browser based document scanning relies on the communication between a local service and the web client. Usually, you need to download the installer of the local service when browsing an online demo of document scanning at the first time. If you want to scan documents from a remote machine, just deploy the service on that machine. Then change the IP for web socket connection.
For example, here is the architecture of Dynamic Web TWAIN.
The scanner should be always connected to the system from where the local service (not the web browser) is launched.
You can watch the video to see how to use Raspberry Pi as the scanner service to capture documents from iMac.
Yes, There is a Application that enable scanning on remote machine. When someone open the browser a connection between web browser and that local machine application established. This connection is done easily by HTML5 Web Socket. Local application do scan and send this image via this connection to your Browser.
Here is the open source repository,
ScanAppForWeb
I'm hoping this will be helpful, though it's not a direct answer to the question.
After spending a lot of time trying to get WebUSB to work try researching other options, I found a solution that works well for my web app. Simply use scanimage to scan to the server. The client sends and AJAX request, the server builds a command string to run with shell_exec in PHP, then use file_get_contents or whatever with the scanned image. In my situation, there's no reason for the scanner to talk to the client, since the image is going to end up in a database on the server anyway.
See also: https://stackoverflow.com/a/63198443/4509516
Extrieve HTTPTWAIN browser-based document scanning SDK support , document scanning from a remote PC. This require service client to be deployed on the remote PC and Web module should connect to the service using ip and port of the remote pc.
To Know more visit- https://www.extrieve.com/web-document-scanning/

Load testing: Choosing between a tool or simulating clients on my own for this scenario?

I want to load test my application and I'm deciding b/w choosing a load testing service or simulating the clients on my own.
My question is whether I can accomplish this user scenario using any of the load testing tools available.
My test will have two types of users, A & B. Communication would be between A and B. A-A communication and B-B communication is not there.
I want Users to login to my application through mobile or web. Either type of users could log in through either type of platform.
Make multiple GET/PUT/POST requests to my application server with specific parameters.
Be able to exchange video or text messages by integrating through services like Pusher and Vidyo.
'3' is probably the most important requirement for me, and I'm wondering if I could simulate the dummy users so that it listens to a pusher channel and can open up a Vidyo iframe in the emulated browser / mobile device for a specific pusher message?
I got on call with Blazemeter and turns out they or anyone in the market doesn't support plugins on emulated browsers. I finally simulated the clients on my own replicating all the server calls a typical browser or mobile device makes for my application.
I haven't yet been able to load test Vidyo and don't know if there's a way to do it except by opening up conferences manually.
I was able to load test services like Pusher and SQS successfully.

When does Windows cancel an in-flight WDF request?

I am writing a Windows device driver using WDF (KMDF) for a USB3 device that transfers data in large chunks at a time. I've written a user-level application that tests this functionality, and for the most part, things work.
The problem I encounter is this: I have found that when I force-close (CTRL+C from a cmd window) the application mid-transfer, the on-going data transfer at the time of cancel immediately stops and the host seems to simply stop communicating with that endpoint. I have observed this on a USB bus trace. The requests return in the function driver as "STATUS_CANCELLED"
I have looked at other similar third party devices and ran their test applications with their drivers on those devices and found that when I kill their test applications mid-data-transfer, the transfer completes before the application closes.
My question:
How/when does Windows decide to kill in-flight requests when applications are closed?
Is there any way to mark the request as "uncancelable"? I've scoured the documentation but found nothing that suggests I need to do something to keep requests from being cancelled behind the scenes mid-transfer.
Any insights appreciated, thanks.
It's not about the device driver; it's about the way the console application handles the Ctrl-C event. The console application must trap the Ctrl-C event, and wait for the transfer to finish before it exits.