3

I want to achieve following functionality and need the help for the same:

  1. I have one server on which there is device connected that prints some bar codes based on pre-formatted command given to it.

  2. Currently there is one desktop application which generates the command and does the job.

  3. Now I want to do this via web, meaning there will be one webpage (say .aspx) and I want to achieve this by javascript.

I am able to generate the pre-formatted command required for printing but I don't know how to send the command to server, whether socket tcp ip or something else.

I have tried using node.js, socket.io, json-socket etc. but nothing is working,

3
  • If you are using TCP why not a web socket? Commented Apr 21, 2014 at 16:26
  • web socket depends on ws protocol which i dont want Commented Apr 21, 2014 at 16:27
  • Ok, sorry... only thing I could think of ;) Commented Apr 21, 2014 at 18:05

2 Answers 2

1

If javascript is a fixed requirement, then no I don't think you'll find a direct solution. You will need to create an intermediary service that will translate websocket protocol to the tcp/ip protocol your software communicates on. I found a package called Websockify that has implementations of this kind of bridge in a few different languages.

Although if you are open to using Flash on the front end, and can meet the security requirements on your backend connection, then Flash socket API could work. I believe Java applets can also manage this.

Sign up to request clarification or add additional context in comments.

Comments

0

I don't believe this is possible to do from inside a web browser. If it were it would be a huge security vulnerability (think about it, you visit an attackers page and all of a sudden your printer starts printing and every shared directory on your network fills to the brim with junk data).

You could run the command on the server (node/.net/anything else...) and have the web platform talk to the server to kick the process off. But that sounds kind of like what you already have set up...

Alternately, if you can change the software on the connected device you could try to give it an HTTP endpoint which responds to POSTs.

2 Comments

Is there any way to include or work with socket in javascript ?
@pratik not at a low level I do not think so.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.