spring-websocket

Spring Boot Stomp WebSocket

感情迁移 提交于 2019-11-30 18:23:33
问题 I seem to be running into an issue bumping up against the 8k size limit that embedded tomcat has for stomp websocket messages. When sending a message from server to client I am getting the following error. Based on the documentation I've read, it seems that tomcat has a limit of 8k for messages going across websockets, but ive also read that Stomp can send partial messages and have the client reassemble them which doesnt seem to be happening. The message is never getting to the client side

How to send message to user when he connects to spring websocket

狂风中的少年 提交于 2019-11-30 15:57:59
I want to send message to user when he connects to spring websocket, I've @Configuration @EnableWebSocketMessageBroker public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { @Autowired private GenervicSerice<User> userService; @Autowired private SimpMessagingTemplate template; private CurrentUser currnetUser; @Override public void registerStompEndpoints(StompEndpointRegistry stompEndpointRegistry) { // TODO Auto-generated method stub stompEndpointRegistry.addEndpoint("/ws").withSockJS(); } @Override public void configureMessageBroker(MessageBrokerRegistry config) {

Spring websocket send to specific people

霸气de小男生 提交于 2019-11-30 12:18:33
问题 I have added custom token based authentication for my spring-web app and extending the same for spring websocket as shown below public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { @Override public void configureMessageBroker(MessageBrokerRegistry config) { config.enableSimpleBroker("/topic", "/queue"); config.setApplicationDestinationPrefixes("/app"); config.setUserDestinationPrefix("/user"); } @Override public void registerStompEndpoints(StompEndpointRegistry

How to increase output buffer for spring sockjs websocket server implementation

瘦欲@ 提交于 2019-11-30 08:27:10
问题 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

Java SockJS Spring client and message size

自古美人都是妖i 提交于 2019-11-30 07:44:52
Using SockJS java client, I am trying to connect to Spring sockjs server and is getting error 1009 for messages (without headers) of ~20Kb. Javascript library works fine. Transport closed with CloseStatus[code=1009, reason=The decoded text message was too big for the output buffer and the endpoint does not support partial messages] in WebSocketClientSockJsSession [id='9fa30eb453e14a8c8612e1064640646a, url=ws://127.0.0.1:8083/user] I have couple of config classes on server (I do not know at the moment if I am configuring these things more times than necessary): @Configuration @EnableWebSocket

Spring websocket send to specific people

萝らか妹 提交于 2019-11-30 04:18:28
I have added custom token based authentication for my spring-web app and extending the same for spring websocket as shown below public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { @Override public void configureMessageBroker(MessageBrokerRegistry config) { config.enableSimpleBroker("/topic", "/queue"); config.setApplicationDestinationPrefixes("/app"); config.setUserDestinationPrefix("/user"); } @Override public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/gs-guide-websocket").setAllowedOrigins("*").withSockJS(); } @Override

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

折月煮酒 提交于 2019-11-30 03:23:15
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 below exception on startup. If I remove @EnableAsync it works fine, but I need the async functionality.

How to send message to user when he connects to spring websocket

谁说我不能喝 提交于 2019-11-29 23:00:52
问题 I want to send message to user when he connects to spring websocket, I've @Configuration @EnableWebSocketMessageBroker public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { @Autowired private GenervicSerice<User> userService; @Autowired private SimpMessagingTemplate template; private CurrentUser currnetUser; @Override public void registerStompEndpoints(StompEndpointRegistry stompEndpointRegistry) { // TODO Auto-generated method stub stompEndpointRegistry.addEndpoint(

Spring Websocket in a tomcat cluster

十年热恋 提交于 2019-11-29 20:29:15
In our current application, we use Spring Websockets over STOMP. We are looking to scale horizontally. Are there any best practices on how we should handle websocket traffic over multiple tomcat instances and how can we maintain session info across multiple nodes.Is there a working sample that one can refer to? Thanh Nguyen Van Your requirement can be divided into 2 sub tasks: Maintain session info across multiple nodes: You can try Spring Sessions clustering backed by Redis (see: HttpSession with Redis ). This very very simple and already has support for Spring Websockets (see: Spring Session

Examples of use ReactorNettyWebSocketClient

。_饼干妹妹 提交于 2019-11-29 15:20:46
问题 New Spring has some WebSocketClient example on Spring documentation. WebSocketClient client = new ReactorNettyWebSocketClient(); client.execute("ws://localhost:8080/echo"), session -> {... }).blockMillis(5000); But it is very short and not clear: How to send a message to the server (subscribe to a channel)? Then handle incoming stream and emit Flux messages? Reconnect to the server when the connection is interrupted? Could some one provide more complex example? UPD. I tried to do something