spring-websocket

Spring 4 websocket + Tomcat 7.54 async-supported not working

北城以北 提交于 2019-11-29 11:26:38
I am creating a sample chat application using the Spring websockets and stomp.js , I am using the tomcat 7.54 but while runing the application I am gettting a async-supported error when browser is making xhr request. Server info: Apache Tomcat/7.0.54 Servlet version: 3.0 JSP version: 2.2 Java version: 1.7.0_25 Web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <servlet> <async

SimpMessagingTemplate not sending messages to websocket

喜夏-厌秋 提交于 2019-11-29 07:34:31
I have the following contoller @Controller public class GreetingController { @MessageMapping("/hello") @SendTo("/topic/greetings") public Person greeting(String message) throws Exception { Person person=new Person(); person.setAge(10); return person; } @Autowired private SimpMessagingTemplate template; @RequestMapping(path="/meeting",method=RequestMethod.POST) public @ResponseBody void greet() { this.template.convertAndSend("/topic/greetings", "message"); } } and my configuration is @Configuration @EnableWebSocketMessageBroker public class WebSocketConfig1 extends

How to increase output buffer for spring sockjs websocket server implementation

拈花ヽ惹草 提交于 2019-11-29 06:46:50
I have used spring implementation of sockjs websocket server and unable to transmit message over 8KB, following is the error 2014-02-12 19:36:29,990 - org.springframework.web.socket.sockjs.transport.session.WebSocketServerSockJsSession - DEBUG - SockJS session id=35n41xel was closed, CloseStatus [code=1009, reason=The decoded text message was too big for the output buffer and the endpoint does not support partial messages] Any Idea how can I increase the buffer size I used following factory as spring sockjs leverages tomcat container (App is deployed in tomcat and I also debugged to confirm

Is it possible to send binary data with STOMP over WebSockets using Spring-WebSockets?

半腔热情 提交于 2019-11-29 02:07:10
I am able to send and receive JSON with STOMP over WebSockets following spring documentation . However performance is poor at large high rates, so I wish to profile the use of binary messages. Spring-WebSockets 4.0 JavaScript client running in Chrome 35 stomp.js 1.7.1 Sending I send messages using SimpMessageTemplate with the necessary broker relay - see spring documentation @Controller public class DemoBinaryController { @Autowired private SimpMessagingtemplate template @Scheduled(fixedDelay = 5000) public void demo() throws Exception { GenericMessage<byte[]> message = new GenericMessage<byte

Spring Boot Websockets in Wildfly

有些话、适合烂在心里 提交于 2019-11-29 01:09:42
Hi I need to deploy my Spring Boot app into Wildfly 8.1 and I'm getting the following exception: Caused by: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to io.undertow.websockets.jsr.ServerWebSocketContainer at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:219) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService

Spring Async issue when upgrading from 4.2.0.RC3 to 4.2.0.RELEASE

霸气de小男生 提交于 2019-11-29 00:26:52
问题 I've a web application using the spring(4.2.x) artifacts spring-webmvc, spring-messaging, spring-websocket I've the below @Enable* annotations in my spring config java class @EnableWebMvc @EnableWebSocketMessageBroker @EnableAsync @EnableMBeanExport WebSocket is used for broadcasting messages to browser clients. And there are few async methods annotated with @Async The application was working fine with spring version 4.2.0.RC3. But when I changed it to the GA release 4.2.0.RELEASE, I get the

Disconnect client session from Spring websocket stomp server

喜欢而已 提交于 2019-11-28 21:21:53
I've searched quite a bit and been unable to find this: Is there a way that a spring websocket stomp server can disconnect a client based on the sessionId (or really based on anything at all)? It seems to me that once a client connects to a server there is nothing that allows the server to disconnect the client. As far as I know the API doesn't provide what you are looking for, on server-side you can only detect disconnect events. If you want to disconnect a certain client I think you must go for a litte workaround, e.g. this one: Write a client-side javascript function that is able to trigger

How to send message to client through websocket using Spring

不羁岁月 提交于 2019-11-28 20:19:29
问题 I try to use Spring with websocket. I started my investigation with this tutorial. In my side client I have something like that to initialize the connection to the server : function connect() { var socket = new SockJS('/myphotos/form'); stompClient = Stomp.over(socket); stompClient.connect({}, function(frame) { setConnected(true); console.log('Connected: ' + frame); stompClient.subscribe('/topic/greetings', function(greeting){ showGreeting(JSON.parse(greeting.body).content); }); }); } It

Where “user” comes from in convertAndSendToUser works in SockJS+Spring Websocket?

余生长醉 提交于 2019-11-28 18:21:26
I would like to understand how convertAndSendToUser works in Spring SockJS+Websocket framework. In client, we would connect as stompClient.connect(login, password, callback()) which will result in connect request with "Stomp credentials" of login and password, that can be seen e.g. if we handle SessionConnectEvent http://www.sergialmar.com/2014/03/detect-websocket-connects-and-disconnects-in-spring-4/ But it remains unclear to me whether this will be the "user" meant in server-side send operation to a queue: simpMessagingTemplate.convertAndSendToUser(username, "/queue/reply", message); The

Shall I use WebSocket on ports other than 80?

一曲冷凌霜 提交于 2019-11-28 16:48:38
Shall I use WebSocket on non-80 ports? Does it ruin the whole purpose of using existing web/HTTP infrastructures? And I think it no longer fits the name Web Socket on non-80 ports. If I use WebSocket over other ports, why not just use TCP directly? Or is there any special benefits in the WebSocket protocol itself? And since current WebSocket handshake is in the form of a HTTP UPGRADE request, does it mean I have to enable HTTP protocol on the port so that WebSocket handshake can be accomplished? Shall I use WebSocket on non-80 ports? Does it ruin the whole purpose of using existing web/HTTP