Is there a Java equivalent of SignalR? [closed]

2022-09-01 13:18:36

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.


答案 1

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.


答案 2

There is a Play framework module SignalJ

Update: SignalJ looks dead, look Scala Web Sockets


推荐