How to interface an hardware device using javascript?

时间:2017-10-12 09:37:18

标签: javascript asp.net-mvc

I had developed a web application in ASP.NET MVC using C# which is used for billing purpose. But now the client had a new requirement that he need to connect swiping device so that the customers can pay using their cards. Now the issue is that how i communicate with the device from javascript? i had tried web socket but is not succeed.Is there any ways to make this possible ?

2 个答案:

答案 0 :(得分:1)

You can use the self host Web API to communicate with the swiping device.

  • You can simply create a self hosted Web API to communicate with the swiping device
  • Make it run on the client machine
  • Call the API from your java script

It will work perfectly

答案 1 :(得分:-2)

Look at the documentation of the swiping device, it should explain how you should interface with it.

Of course there's no web browser API to interface with every imaginable peripheral device, so you're simply going to have to put your software development skills to work and create a compatibility layer.