How to communicate a local application with an open web page in the browser?

Asked

Viewed 587 times

4

I have a commercial web application that runs basic restaurant operations. In summary, a waiter accesses the 'orders' page and requests a new 'product'. These products are classified by departments, and each department has a printer (thermal/matrix) where the request will be printed!

As the browsers do not allow me to change the printer to be used by parameters, the waiter would have to choose the printer manually, which is completely unviable!

Yesterday, discussing it here in the OS, I was suggested to create an application, which installed locally in my client, could serve as an interface for this impression. But I have no idea how to do that?

What I need is this: When the user sends the request for a new product to the server (via AJAX), if the returned JSON is successful, my page 'warns' the local application (or something similar) that selects the responsible printer, and sends the coupons!

But how do I communicate? Is there any protocol?

I need at least one direction, because so far, I don’t even know where to start!

Web application developed in ASP.net MVC 4 with C# and Sqlserver.. the local application has not yet been written, and although we are open to solutions in any technology, the preference is for C#,

  • You will have to write a web server. Communication can be via HTTP or TCP with websockts.

  • @bigown.. In this case what would be the communication? The local application would communicate with a webserver, which would keep a cache of, for example, print information?

  • More or less that, in addition to the activities of the webserver, you can do anything you want on it. The browser won’t even know it’s communicating with something specific. This server needs to do everything a browser expects (of course it may have some well-handled limitations). I have already said something about this at http://answall.com/a/31942/101

  • AJAX is not a language and only a protocol. The page on the server will receive data and will respond. One option would be to create a JAVA applet. As the Applet will be in the "browser" it will be able to print locally. Here is a page with explanations about a system of this type, to print labels. The documents are in Frances, but Google Translator is enough to understand and the information is well detailed. http://lgl.isnetne.ch/d6ithemes/appletImpression.htm

1 answer

1

There’s a way to do something similar. With an application WindowsForms you can make a simple form that will contain a component webBrowser and with it you can use C# itself to perform the printer configuration, run some other application, or do directly in this application.

So you keep all the business logic in the web application and deal locally with the printer part.

Here’s a link that might help you get an idea of what I said:

http://notions.okuda.ca/2009/06/11/calling-javascript-in-a-webbrowser-control-from-c/

  • that would be cool! Would this 'webbrowser' be like a iexplorer guide? It depends on the client’s browser or is it independent?

  • As far as I know, it uses IE, which is native to the windows OS, to render web pages. But if necessary, there are some web tutorials that show you how to create a webbrowser component using Webkit, which Chrome uses, for example. It is up to you to validate which operating systems should be supported by your application. This case I mentioned applies to Windows, if it is to use on IOS, which I find a little difficult by its description, or in linux-based OS should not work!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.