What protocol to use in desktop application to receive server events
I have a Desktop application that needs to have a bi-directional communication channel for exchanging data with the remote server over the Internet. I don't think that opening a Listener in a Desktop application will work in this environment b/c it needs to work via NAT routers, firewalls, etc.
Basically, pushing data from Desktop App to server is not a problem - this could be done via REST API for example. The more challenging task is to be able to receive data generated server-side, i.e. reacting to the server-side events, preferably with minimal delay.
One way could be doing a long polling over https. Another way could be opening a WebSocket connection over wss. I wonder if there are other ways to achive bi-directional async communication between desktop app and a remote server? Thank you!
Option 1 - long polling / SignalR library
Option 2 - need to take a closer look at XMPP (aka Jabber) protocol (Extensible Messaging and Presence Protocol) and corresponding client software libraries. The classic XMPP works via direct TCP socket connections, which will not fit here.
However, there is also XMPP over BOSH (Bidirectional streams over Synchronous HTTP). BOSH will be a perfect fit here because BOSH is essentially a long polling in context of XMPP.
Besides XMPP, other protocols to look at may include STOMP, AMQP.
Serialization protocols to consider: usual suspects like XML, JSON, as well as Protobuf, Apache Thrift, Apache Avro.