Well those systems you mention work as follows. They first try to make client A and client B communicate directly via a range of different topologies which basically require one of them to allow incoming connections if that fails they fall back on a third party which acts as a man in the middle. So client A talks to the server and sends it messages for client B. Then Client A gets the messages addressed to it back in response. Client B sends it messages to the server and it's gets the message from client A back from the server. This way both client A and B always initiate the connection and don't need to have a port open for incoming traffic.
If I understand correctly in your case you would always want the man in the middle. In order to do this you would have to write a WCF service that provides all relevant methods. For instance things like
- void SendMessageToClient(Guid senderId, Guid recipientId, Message msg)
- Message[] GetMessages(Guid recipientId)
then have those methods respectively store and retrieve those Message objects from somewhere (like a database or a queue or something).
Then write a client that connects to the WCF service using the HTTP binding and call the methods on the server and process the results.
I hope you understand that
- a) this isn't a very efficient way to communicate.
- b) that it's difficult to test and debug and understand whats going on since there are so many parties involved and communication is asynchronous living in 3 different processes.
- c) it adds an extra layer ontop of the communication so you need to keep it clear for yourself in your head (and prefereably in code) when you are dealing with the infrastructure bits and when you are dealing with the actual protocol clientA and clientB speak to each other in the Message objects.
Pseudo (code) Example
in this example I assume the message object is nothing more then a string and the only command is "whattimeisit" to which the response is the local time in string form
- ClientA makes call to server.SendMessageToClient("clientA", "clientB", "whattimeisit");
- Server stores this message in the database with ID 1
- ClientB makes call to server GetMessages("clientB");
- Server retrieves message with ID 1
- ClientB recieves back "whattimeisit" as a response
- ClientB makes call to server.SendMessageToClient("clientB", "clientA", "19:50:12");
- Server stores this message in the database with ID 2
- ClientA makes call to server GetMessages("clientA");
- Server retrieves message with ID 2
- ClientA recieves back "19:50:12" as a response