Monday, 12 August 2013

Talking between Web Applications and Desktop Applications

Talking between Web Applications and Desktop Applications

So I have been thinking of the best way to implement a native desktop app
that can print from data generated via a Web App. The method I have come
up with looks much like this.
From the End User Experience
User Clicks Print within the Web App to a printer of their choice from a
simple dropdown.
Print Data is saved to a Message Queue for that printer (RabbitMQ or
something)
They Just expect it to come out instantly from the printer they selected.
From the Native Application
Application is Installed on a machine with credentials.
Printers are setup within the app and this data is sent to the web app
database.
App constantly opens a connection to each printer's Message Queue and
checks for messages.
Now the question is with the connection from the native app to the message
queue. My biggest concern is staying away from firewalls and not flooding
the network with requests. So I think the best way to do this is to only
create outgoing communication from the app and not expect it to be reached
externally.
So do I use one of the following or is something better?
A simple GET request which just reponds with a 200 with body if there is
data or a 204 - No Content if the queue is empty so no body is expected.
A HEAD request which does the same as above but 200 will have no body.
When it does get a 200 it starts another request to actually fetch the
data.
Do I not use HTTP and instead use another protocol. The only thing is I
need the web application to authenticate the native application on every
request. Which was going to be an oAuth implementation.
The other issue is that I also need to look instantaneous so if I am
polling it would need to be every 5 seconds with of course an inactivity
monitor or something that will slow down polling to 30 seconds.

No comments:

Post a Comment