Need to call client side DLL from browser

后端 未结 3 1863
心在旅途
心在旅途 2021-01-03 05:12

I got requirement from client that when any user swipe their card then their details should be capture in web page automatically on client side. However same we are doing in

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-03 05:50

    I had to do the exact same thing and I've done it using EdgeJS. You can find the answer at Call Function from DLL loaded in front-end javascript (load dll in clientside javascript) .
    At first, I used activex for IE. Then, I had to port it to other browsers. The trick is to marshal functions between V8 and CLR and when the event triggers you send the message to javascript.


    The dll returns a delegate function as a receive handler. You initialize the dll with the send handler. I haven't found a method to run the dlls from the browser yet as you do with ActiveX.


    It might be that, for security reasons, you might not be able to embed and run dlls in clientside javascript.

    The solution in the stackoverflow question is a node process that runs on the client computer that has the Swipe Reader. The client application connects to the node process that runs a websocket server and communicates through websocket messages. I think you can port this on every platform (Win, Unix, MacOS).

    Another solution is to build a C# application (windows only if you use .NET, all platforms if you only use the CoreCLR) that listens to swipes and triggers an event to send the data on all connected websockets.

提交回复
热议问题