spring-websocket

Spring WebSocket ConvertAndSendToUser not working but convertAndSend working

拟墨画扇 提交于 2020-12-12 08:55:33
问题 I am new to Spring boot websocket and messaging semantics. Currently i am able to send private messages using the below code. String queueName = "/user/" + username + "/queue/wishes"; simpMessagingTemplate.convertAndSend(queueName, message); When trying to use convertAndSendToUser I am not getting any error but the message is not getting sent. I knew that with sendToUser there should be a slight change in how the destination name should be formed but I am not getting it right. String

Unit Test For Websocket Returns Null

旧巷老猫 提交于 2020-07-22 06:27:11
问题 I am trying to implement unit test for a Websocket in Springboot with JUnit . I am following this link and it runs fine but gets null in the result, when i test my websocket with a browser it sends the desire results. let me show my test class @ExtendWith(SpringExtension.class) @SpringBootTest(classes =Main.class) @WebAppConfiguration public class WebSocketTest { static final String WEBSOCKET_URI = "http://localhost:8080/api/realtimedata"; static final String WEBSOCKET_TOPIC = "/realtimedata"

Spring WebSocket Simple Example - java.lang.IllegalStateException: Unexpected use of scheduler

五迷三道 提交于 2020-07-06 19:25:38
问题 I'm trying to implement a WebSocket server in Spring without STOMP, following this article: http://www.devglan.com/spring-boot/spring-websocket-integration-example-without-stomp WebSocketConfig.java @Configuration @EnableWebSocket public class WebSocketConfig implements WebSocketConfigurer { @Autowired private WebSocketHandler webSocketHandler; @Override public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { registry.addHandler(webSocketHandler, "/app"); } }

Websocket Client not receiving any messages

你。 提交于 2020-06-29 04:06:53
问题 I have Python client which opens a websocket connection to a server and subscribes to particular topic using STOMP protocol, subscription goes just fine as i see on the server all is fine. However, When the server publishes a few messages the client does not receive any. Here are the codes used: Client # coding: utf-8 import websocket import stomp import stomper token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9

Spring boot Websocket with stomp js: I keep getting Whoops! Lost connection to http://localhost:8080/ws

北城以北 提交于 2020-05-29 08:25:36
问题 I want to integrate chatting into an application I made, and after following some tutorials and running the application I keep getting "Whoops! Lost connection to http://localhost:8080/ws" on my console I tried using sockjs path as"/ws" but still got the same error, please can someone explain to me what i am doing wrong ? here is the snippet of my code: @Configuration @EnableWebSocketMessageBroker public class WebSocketConfiguration extends AbstractWebSocketMessageBrokerConfigurer { @Override

Spring boot Websocket with stomp js: I keep getting Whoops! Lost connection to http://localhost:8080/ws

人走茶凉 提交于 2020-05-29 08:25:27
问题 I want to integrate chatting into an application I made, and after following some tutorials and running the application I keep getting "Whoops! Lost connection to http://localhost:8080/ws" on my console I tried using sockjs path as"/ws" but still got the same error, please can someone explain to me what i am doing wrong ? here is the snippet of my code: @Configuration @EnableWebSocketMessageBroker public class WebSocketConfiguration extends AbstractWebSocketMessageBrokerConfigurer { @Override

How can I detect a disconnected client with Spring 5 Reactive WebSocket

此生再无相见时 提交于 2020-05-13 11:48:52
问题 I managed to create a WebSocketHandler using the Spring 5 Reactive WebSocket support (Chapter 23.2.4). Receiving and sending all works fine. However, I can not figure out how to detect a client disconnect. When debugging a client disconnect it somewhere stops at the server side in the HttpServerWSOperations class ( netty.http.server package), where it does detect a CloseWebSocketFrame . Any suggestions how to deal with client disconnects? 回答1: I implemented a close event handler in a reactive

How can I detect a disconnected client with Spring 5 Reactive WebSocket

别说谁变了你拦得住时间么 提交于 2020-05-13 11:48:09
问题 I managed to create a WebSocketHandler using the Spring 5 Reactive WebSocket support (Chapter 23.2.4). Receiving and sending all works fine. However, I can not figure out how to detect a client disconnect. When debugging a client disconnect it somewhere stops at the server side in the HttpServerWSOperations class ( netty.http.server package), where it does detect a CloseWebSocketFrame . Any suggestions how to deal with client disconnects? 回答1: I implemented a close event handler in a reactive

WebSocketMessageBrokerStats - how to set loggingPeriod

回眸只為那壹抹淺笑 提交于 2020-04-15 10:43:11
问题 How to set loggingPeriod in WebSocketMessageBrokerStats to decrease value (default is 30') WebSocketMessageBrokerStats is loaded by @Bean in WebSocketMessageBrokerConfigurationSupport version : Spring 4.2.0.RELEASE My current Config : @Configuration @EnableWebSocketMessageBroker @EnableScheduling public class AppWebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { @Override public void configureMessageBroker(final MessageBrokerRegistry config) { config.enableSimpleBroker("/topic

WebSocketMessageBrokerStats - how to set loggingPeriod

久未见 提交于 2020-04-15 10:41:59
问题 How to set loggingPeriod in WebSocketMessageBrokerStats to decrease value (default is 30') WebSocketMessageBrokerStats is loaded by @Bean in WebSocketMessageBrokerConfigurationSupport version : Spring 4.2.0.RELEASE My current Config : @Configuration @EnableWebSocketMessageBroker @EnableScheduling public class AppWebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { @Override public void configureMessageBroker(final MessageBrokerRegistry config) { config.enableSimpleBroker("/topic