有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

websocket是否有一个Java版本的Signal?

我有一个非常简单的问题,但我发现谷歌上没有什么有趣的东西

有没有与signer(.NET)相当的Java语言

信号员是一名飞行员。NET框架,该框架实现了Websockets,并为旧浏览器提供了一个后备方案

真的谢谢你


共 (2) 个答案

  1. # 1 楼答案

    看来Atmosphere就是你想要的

    从github描述:

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

    我还没有试过,但{a2}说它支持主要的JEE服务器(JBoss、Tomcat、Glassfish、Jetty)和所有主要的浏览器和传输(WebSockets、SSE、Long Polling等)

    2014年6月4日更新: 还有另一个值得注意的选择是“Java等效于Signal”。从4.0版开始,Spring框架为SockJS提供了support for WebSockets和服务器端支持。这意味着它还支持WebSocket回退,与浏览器端sockjs-client库一起使用。 正如Spring文档所说:

    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.

    尽管如此,我不知道现在的Java框架是否支持SignalR Hubs(这涉及JavaScript代码生成)之类的东西,但另一方面,我认为您可以很容易地模仿类似SignalR的PersistentConnection,对旧浏览器提供完全的回退支持

    此外,由于JSR 356又名用于WebSocket的Java API,我认为所谓的“主流”Java Web框架何时能够提供对WebSocket+后备的开箱即用支持只是时间问题,特别是考虑到所有主要的servlet容器(如Tomcat和Jetty)和JEE 7服务器(Glassfish、Wildfly)都已经支持JSR356

  2. # 2 楼答案

    有一个播放框架模块SignalJ

    更新:SignalJ看起来死了,看Scala Web Sockets