stomp

Disconnect client session from Spring websocket stomp server

China☆狼群 提交于 2019-11-27 12:56:18
问题 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. 回答1: 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

Path variables in Spring WebSockets @SendTo mapping

两盒软妹~` 提交于 2019-11-27 11:14:11
I have, what I think to be, a very simple Spring WebSocket application. However, I'm trying to use path variables for the subscription as well as the message mapping. I've posted a paraphrased example below. I would expect the @SendTo annotation to return back to the subscribers based on their fleetId . ie, a POST to /fleet/MyFleet/driver/MyDriver should notify subscribers of /fleet/MyFleet , but I'm not seeing this behavior. It's worth noting that subscribing to literal /fleet/{fleetId} works. Is this intended? Am I missing some piece of configuration? Or is this just not how it works? I'm

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

倖福魔咒の 提交于 2019-11-27 10:34:37
问题 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

Automatic reconnect with Stomp.js in Node.js application

天大地大妈咪最大 提交于 2019-11-27 05:43:17
问题 I'm working with an application that is written in Node.js and Express, and I'm trying to use the Stomp.js client to connect to an ActiveMQ server. I can get the application to connect to ActiveMQ just fine using Stomp, but I am unable to get the system to automatically reconnect upon connection failure. It seems like the failure function is only called if the connection is initially successful and then later severed, though if ActiveMQ is already down when the Node app starts, I do see the

Spring WebSocket @SendToSession: send message to specific session

邮差的信 提交于 2019-11-27 02:43:26
Is it possible to send a message to specific session? I have an unauthenticated websocket between clients and a Spring servlet. I need to send an unsolicited message to a specific connection when an async job ends. @Controller public class WebsocketTest { @Autowired public SimpMessageSendingOperations messagingTemplate; ExecutorService executor = Executors.newSingleThreadExecutor(); @MessageMapping("/start") public void start(SimpMessageHeaderAccessor accessor) throws Exception { String applicantId=accessor.getSessionId(); executor.submit(() -> { //... slow job jobEnd(applicantId); }); }

Set up a Stomp client in android with Spring framework in server side

坚强是说给别人听的谎言 提交于 2019-11-27 01:41:52
问题 I am developing an android application that exchanges data with a jetty server configured in Spring. To obtain a more dynamic android application, i am trying to use WebSocket protocol with Stomp messages. In order to realize this stuff, i config a web socket message broker in spring : @Configuration //@EnableScheduling @ComponentScan( basePackages="project.web", excludeFilters = @ComponentScan.Filter(type= FilterType.ANNOTATION, value = Configuration.class) ) @EnableWebSocketMessageBroker

How to find all users subscribed to a topic in spring websockets

谁说胖子不能爱 提交于 2019-11-27 00:56:48
问题 When making something like a chat application using Spring Websockets, it is useful to know who all is subscribed to any given topic. For, e.g. presence data displayed in the clients. I know that I can implement ApplicationListener and keep my own list of "connected users", but it seems like the library must already be doing this work. What's the recommended way to get active subscription info from the library directly (and without maintaining my own list in memory or db). 回答1: You're right,

SockJS receive stomp messages from spring websocket out of order

跟風遠走 提交于 2019-11-26 16:32:20
问题 I am trying to streaming time series data using Springframework SimpMessagingTemplate (default Stomp implementation) to broadcast messages to a topic that the SockJS client subscribed to. However, the messages is received out of order. The server is single thread and messages are sent in ascending order by their timestamps. The client somehow received the messages out of the order. I am using the latest release version of both stompjs and springframework (4.1.6 release). 回答1: Found the root