2

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.

lucidgold
  • 4,432
  • 5
  • 31
  • 51
  • you say "due to transport requirments, my communication will not utilize WebSockets." then you are asking how to use websockets? Or did you try it and it not work? – rogerdpack Jan 02 '14 at 21:05
  • @rogerdpack: reading through SignalR requirements, to get WebSockets transport activated I must use Windows8+ with .Net Framework for 4.5+. There is a fallback mechanism that will use transports other than WebSockets if system requirements are not met. – lucidgold Jan 02 '14 at 21:09
  • so you're concern here is you wont' have Windows8+ so you can't use SignalR, and your question is "how to communicate through to c# using something else"? – rogerdpack Jan 02 '14 at 21:14
  • @rogerdpack: that is correct, which is why I looked into XSockets.Net but it seems that it does not support Java? I will update my question to reflect your comment, thanks! – lucidgold Jan 02 '14 at 21:18
  • Since your bytes will be coming "through the websocket" from java, you can use whatever library you want on the 2 sides, it doesn't have to be the same (now, for marshalling the bytes so that you can send something meaningful, that's a different story...) – rogerdpack Jan 02 '14 at 22:00
  • @rogerdpack: is that because the library used on both sides is not the same, so the data processing/marshalling will result in meaningless data? I thought since WebSockets follow a standard protocol, therefore any library should support its message structure, and then it shouldn’t be an issue of extracting correct data based on its standard structure. Do I understand you correctly or am I on cloud 9? – lucidgold Jan 02 '14 at 22:23
  • websockets are just the protocol, you can send anything you want through them. So basically you need to marshal data somehow in your own way using some library or other (or two libraries that know how to talk to each other, or write your own on both sides). HTH. – rogerdpack Jan 02 '14 at 22:27
  • @rogerdpack: you are correct. I will now look into deploying a C# XSockets Server and have a C# XSockets client and a Java JWebSockets 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. – lucidgold Jan 02 '14 at 23:33
  • FYI: We're working on a java client :) – davidfowl Jan 07 '14 at 06:30
  • @dfowler: What are you using? XSockets.NET or JWebSockets? – lucidgold Jan 07 '14 at 19:57
  • Huh? When I say we, I mean the SignalR team is implementing java client for SignalR – davidfowl Jan 08 '14 at 08:33
  • @lucidgold Good news for you! XSockets just released cross protocol communication. This means that you can create custom protocols and connect from anything (language or device) and still talk sockets to a browser that uses RFC6455 etc – Kim See Jonge Jan 16 '14 at 20:43

2 Answers2

4

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

Uffe
  • 2,275
  • 1
  • 13
  • 9
0

In my humble opinion, you have misunderstood some things.

XSockets and SignalR are libraries which are totally oriented to a specific platform, .NET. They both wrap the functionality of WebSockets, a platform independent standard, to ease its use. This does not by anyway mean that you could use XSocket, or SignalR libraries in all platforms.

I suppose that creating a java client for XSockets or SignalR would be an overkill and would lead you to heavily depend on a 3rd party library. In your situation, I would go on with using WebSockets directly on my server side. Then I would use a library handling the WebSockets standard for each client, which could be different for each client development platform. Therefore, you would depend on one universal standard and you would minimize dependencies on 3rd party libraries.

Hope I helped!

Pantelis Natsiavas
  • 5,293
  • 5
  • 21
  • 36
  • 1
    The websocket protocol sucks, and you will need to use a library/framework that has done all the hard work for you. Or you can do it all your self but it will take you a loooong time. – Kim See Jonge Jan 10 '14 at 21:57
  • 1
    @Kim You have not read my answer carefully. I also suggest using a library on the client side to handle web sockets. I just said that he/she should not make a java client for a .net library. Don't you think this would cost even more in time? I respectfully disagree with you downvoting. – Pantelis Natsiavas Jan 11 '14 at 07:41
  • 2
    I did NOT downvote you! Someone else did, get your info correct before jumping the gun. I know what you said and my opinion is that you are in need of a library much more on the server side then on the client side! Even though I would recomend to use libs on both sides! If he has (for example) a .NET server I see nothing wrong in writing a Java client for it. The important thing is that you can write custom clients and custom protocols for the server of choice so that you can communicate over anything (with anyhting) regardless of device or language. – Kim See Jonge Jan 11 '14 at 08:03