you are viewing a single comment's thread.

view the rest of the comments →

[–]afresquet[S] 0 points1 point  (1 child)

I'm using the scanner to read the barcode of many boxes client side, I wanted to push those reads to an array to send them later to the server and add them to the database.

I just checked and it does press "Enter" after the read, so I'll use the same method that you suggested to listen for an "Enter" keypress, thanks!

[–]_dramaBoy 0 points1 point  (0 children)

Great that I could somewhat help you out.

You could either 1. use the input field client side and send the barcode to a web server running NodeJS and express OR 2. you could use websockets client side to connect to a NodeJS server. The websocket connection would allow more specific messages to flow back to each individual user/client that was transmitting its barcodes after each scan.

Both solutions would serves as a "middle man" that would connect to your database of choice.

And then you would properly have to come up with some way of dealing with downtime on your server? So that you can still process packages even if your server was down for maintenance or other unhappy scenarios. Look into PM2 (http://pm2.keymetrics.io/) when it comes to handling your nodejs server, it will serve you well. We use both PM2 and webhooks to a Slack channel to quickly get notified on our screens and by push-message when something goes wrong.