0

Here is my problem. I have a hardware scanner connecting to a windows computer. When I scan an item windows computer will get the price/information about this item. I will insert the price to my database through windows program/c# program.

I have a web application, which has access to the same database with c# program . This web application should be open at the time when I do scanning. I would like the changes in db is reflected to web browser right at the time when I scan.

Is this related with javascript technology(or other technology)? Is this possible?

Thanks

wwli
  • 2,623
  • 6
  • 30
  • 45
  • if my answer solved your problem please upvote and mark as top answer, if not please add comments or more details so other users struggling with the same will know what to do – Simon McLoughlin May 13 '13 at 09:09

2 Answers2

2

If your web app, running on your web server has access to the database and can be notified of changes, you could use an HTTP Persistent (aka Keep-Alive) connection to 'push' updates down the pipe to the browser where your JS could pick them up

http://en.wikipedia.org/wiki/HTTP_persistent_connection

More details here: Persistent connection with client

Community
  • 1
  • 1
Laurence Moroney
  • 1,263
  • 8
  • 20
1

what you need is to maintain a TCP socket connection from the webpage to the server, when the database updates the server will send a message on this socket to alert the webpage and the page can update.

Take a look at this question for a few possible solutions, i'd recommend node.js

How can I communicate over TCP sockets from JavaScript?

Community
  • 1
  • 1
Simon McLoughlin
  • 8,293
  • 5
  • 32
  • 56