Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Java equivalent of SignalR? [closed]

I've got a really simple question but I find nothing interesting on Google.

Is there a Java equivalent of SignalR (.NET) ?

SignalR is a .NET framework that implements Websockets with a fallback for old browsers.

Really thx to you.

like image 236
Thomas Pons Avatar asked Jun 27 '13 08:06

Thomas Pons


People also ask

What is SignalR in Java?

The SignalR Java client uses the SLF4J library for logging. It's a high-level logging API that allows users of the library to choose their own specific logging implementation by bringing in a specific logging dependency.

What is the difference between SignalR and web sockets?

WebSockets is actually the underlying transport that SignalR uses, at least most of the time. SignalR has the ability to fall back to other ways of transporting messages, such as long-polling over HTTP. This is useful in situations where you don't have WebSockets support.

What is the use of SignalR?

SignalR handles connection management automatically, and lets you broadcast messages to all connected clients simultaneously, like a chat room. You can also send messages to specific clients.


2 Answers

It seems that Atmosphere can be this what you are looking for.

From github description:

The Atmosphere Framework contains client and server side components for building Asynchronous Web Application.

I didn't tried it yet, but this says that it supports major JEE-Servers (JBoss, Tomcat, Glassfish, Jetty) and all major browsers and transports (WebSockets, SSE, Long-Polling etc).

UPDATE 6/4/2014: There is another notable alternative for "Java equivalent of SignalR". As of version 4.0, Spring Framework comes with support for WebSockets and server-side support for the SockJS. It means that it supports also WebSocket-Fallback, used together with a browser side sockjs-client library. As Spring Documentation says:

WebSocket is not supported in all browsers yet and may be precluded by restrictive network proxies. This is why Spring provides fallback options that emulate the WebSocket API as close as possible based on the SockJS protocol [...] On the browser side, applications can use the sockjs-client that emulates the W3C WebSocket API and communicates with the server to select the best transport option depending on the browser it’s running in.

Still I'm not aware if there is support for something like SignalR Hubs (which involves JavaScript-code generation)in the Java Framework as of today, but on the other side I think you can easily imitate a SignalR-like PersistentConnection with full fallback support for older browsers.

Furthermore, because of JSR 356 aka Java API for WebSocket, I think it is only a question of time when the so to say "mainstream" Java Web-frameworks will be shipped with out-of-the-box support for Websockets+Fallback, especially considering the fact that all main servlet conteiners (like Tomcat and Jetty) and JEE 7 Servers (Glassfish, Wildfly) have support for JSR 356 already.

like image 155
Mateusz Szulc Avatar answered Oct 12 '22 04:10

Mateusz Szulc


There is a Play framework module SignalJ

Update: SignalJ looks dead, look Scala Web Sockets

like image 2
Jonathan Barbero Avatar answered Oct 12 '22 05:10

Jonathan Barbero