Search code examples
c#javawebsocketsignalrxsockets.net

Using WebSockets to communicate between Java and C# desktop applications?


I am interested in deploying a server to GoDaddy as a C# web application, then have desktop clients developed in C# and Java be able to subscribe/publish to the server using WebSockets (RFC 6455).

WebSocket supported libraries I am looking at are XSockets.Net and SignalR.

I am not able to find anything on using XSockets.Net (not to be confused with XSocket.org) in Java. I understand that XSockets targets MS .Net framework and Mono environments. However, looking at SignalR, there is also SignalA which is a Java based SignalR client for Android.

Thinking-out-loud... I understand there are many WebSocket libraries for Java, which suggests the idea that if I am able to publish a message (using WebSocket) from a Java application to a server, then I should be able to read it and processes it in C#, since WebSocket protocol is a standard.

Thus far, I believe a SignalR solution will satisfy my requirement to allow C# & Java applications to talk on the Web, but due to transport requirments of SignalR, my communication will not utilize WebSockets. Reading through SignalR requirements, to get WebSockets transport activated I must use Windows8+ with .Net Framework for 4.5+. GoDaddy does not use Windows8 for windows hosting, and even if it did, then all my clients must also use Windows8, which is not a guarentee.

So the question is: How can I get C# & Java desktop clients to talk on the web via WebSockets, othan than using SignalR and XSockets.Net?

Any help is very much appreciated!

EDIT: I will now look into deploying a C# XSockets.NET Server and have a C# XSockets.NET client and a Java JWebSocket client since both JWebSockets and XSockets support the WebSocket RFC6455 protocol. I will post my findings here and close this question if that was a successful effort.


Solution

  • You can implement a RFC6455 client in any language and use XSockets. However do note that XSockets uses a publish/subscribe pattern that you will have to implement as well to take benefit of the platform.

    The upside is that you actually wont have to implement RFC6455 since you can implement a custom (non websocket protocol) and use that when communicating from desktop (or anything else). Since everything in XSockets is a plugin you can add custom protocols and still communicate with client talking RFC6455 since XSockets will offer cross-protocol communication.

    So the thing you have to implement is actually only the publish/subscribe functionality in the java client. There are probably not any Java clients out there that implements the IXSocketClient interface today, and we focused on Mono instead of Java when covering multi-platform support.

    We will help you out in any way we can if you decide to write your own java implementation.

    Note: as of the next version (not far away) it will be very easy to implement your custom protocol and connect from any device talking TCP/IP