Spring Web Socket Java 客户端
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25867347/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Spring Web Socket Java Client
提问by Sathish Kumar k k
How to Write a Java based Spring Web Socket (STOMP) Client. As in Spring we have only javascript based client is provided using stompJS but if we need a java client how should we need to achive it?
如何编写基于 Java 的 Spring Web Socket (STOMP) 客户端。就像在 Spring 中一样,我们只使用 stompJS 提供了基于 javascript 的客户端,但是如果我们需要一个 Java 客户端,我们应该如何实现它?
采纳答案by Sergi Almar
Spring 4.1 introduces a SockJs Java Clientwhich is quite useful for server to server communication and performance testing. It doesn't come with a Stomp client (this is certainly in the roadmap) but you can check out the tests in the sample appwhich has already an implementation. Seems this is what you are looking for.
Spring 4.1 引入了一个SockJs Java 客户端,它对于服务器到服务器的通信和性能测试非常有用。它没有附带 Stomp 客户端(这当然在路线图中),但您可以查看示例应用程序中已经实现的测试。似乎这就是你要找的。
Update 8 Sep 2015:
2015 年 9 月 8 日更新:
Spring 4.2 has a STOMP Java client which can be used along with the SockJS Java client. More: https://docs.spring.io/spring/docs/4.2.x/spring-framework-reference/htmlsingle/#websocket-stomp-client
Spring 4.2 有一个 STOMP Java 客户端,可以与 SockJS Java 客户端一起使用。更多:https: //docs.spring.io/spring/docs/4.2.x/spring-framework-reference/htmlsingle/#websocket-stomp-client
回答by Denise
I would look for websocket clients in Java and build off of those. It seems that Jetty has a websocket client apias does too tall nate.
我会在 Java 中寻找 websocket 客户端并以此为基础构建。似乎 Jetty 有一个 websocket 客户端 api,太高了 nate 也是如此。