stomp

Spring 4 websocket + stomp + rabbitmq and clustering

穿精又带淫゛_ 提交于 2019-12-05 14:21:54
I am going through Spring 4 websocket + stomp + rabbitmq(RabbitMQ-Web-Stomp plugin) architecture and I have a question about clustering. As per my understanding here Spring MVC act as a gateway for STOMP requests. If we cluster the application instance with spring web socket configuration will it create any confusion? For an example will it open multiple listeners and how will in such a case this architecture behave? In this scenario, you would need to use load balancing and a message broker. I used HAProxy to load balance 4 Spring MVC instances (websocket) running on 4 tomcat servers. Also

How do you replay missed messages when using STOMP to connect to RabbitMQ?

让人想犯罪 __ 提交于 2019-12-05 04:24:43
I've got an iOS application which uses a STOMP Client to talk to RabbitMQ . The application loads a lot of state during startup, and then keeps that state in sync by receiving updates published on STOMP. Of course, if it loses its connection, it can no longer be sure it's in sync, and therefore has to re-load that large initial blob. Any kind of network interruption triggers this behavior and makes my customers sad. There are a lot of big-picture ways to fix this (and I'm working on them) but in the meantime, I'm trying to use persistent queues to solve this problem. The idea is that the

Spring Websockets STOMP - get client IP address

六月ゝ 毕业季﹏ 提交于 2019-12-05 02:42:29
问题 Is there any way to obtain STOMP client IP address? I am intercepting inbound channel but I cannot see any way to check the ip address. Any help appreciated. 回答1: You could set the client IP as a WebSocket session attribute during the handshake with a HandshakeInterceptor : public class IpHandshakeInterceptor implements HandshakeInterceptor { public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, Map<String, Object> attributes)

how to capture subscribe event in my webSocket server with Spring 4

折月煮酒 提交于 2019-12-05 01:45:17
I did a simple web socket communication with spring 4, STOMP and sock.js, following this https://spring.io/guides/gs/messaging-stomp-websocket/ Now I want to upgrade it to simple chat. My problem is that when user subscribes to new chat room, he should get past messages. I don't know how to capture the moment when he subscribed to send him the list of the messages. I tried using @MessageMapping annotation, but didn't reach any success: @Controller public class WebSocketController { @Autowired private SimpMessagingTemplate messagingTemplate; @MessageMapping("/chat/{chatId}") public void chat

SimpMessagingTemplate.convertAndSend with RabbitMQ works very slow

戏子无情 提交于 2019-12-04 17:31:34
问题 I'm using spring STOMP over Websocket with RabbitMQ. All works fine but simpMessagingTemplate.convertAndSend works very slow, call can take 2-10 seconds (synchronously, block thread). What can be a reason?? RabbitTemplate.convertAndSend take < 1s, but I need stomp over websocket.. UPDATE I try to use ActiveMQ and gets the same result. convertAndSend take 2-10 seconds ActiveMQ have default configuration. Web socket config: @Configuration @EnableWebSocket @EnableWebSocketMessageBroker class

StompClientLib - unsubscribe socketclient

て烟熏妆下的殇ゞ 提交于 2019-12-04 16:34:53
I've added StompClientLib in my project and I'm facing problem while unsubscribing a destination topic. Unsubscription of destination gives following error: "org.apache.activemq.transport.stomp.ProtocolException: No subscription matched.\r\tat org.apache.activemq.transport.stomp.ProtocolConverter.onStompUnsubscribe(ProtocolConverter.java:734)\r\tat org.apache.activemq.transport.stomp.ProtocolConverter.onStompCommand(ProtocolConverter.java:262)\r\tat org.apache.activemq.transport.ws.AbstractStompSocket.processStompFrame(AbstractStompSocket.java:151)\r\tat org.apache.activemq.transport.ws.jetty9

Testing Web Sockets with Jasmine

坚强是说给别人听的谎言 提交于 2019-12-04 14:08:22
问题 Here is some code that has been written for web-socket using stomp protocol. function WS(url) { var ws = new SockJS('/notifications'); this.client = Stomp.over(ws), this.client.connect('', '', function() { console.log('Connected'); }, function(error) { console.log('STOMP protocol error: ', error.headers.message); }); } WS.prototype.disconnect = function() { }; WS.prototype.subscribe = function() { }; WS.prototype.unSubscribe = function() { }; WS.prototype.send = function(msg) { }; I found

ActiveMQ - STOMP+SSL with Python STOMP client

冷暖自知 提交于 2019-12-04 12:11:01
Can anyone explain me how to add SSL to the Python STOMP client I'm using. I added the stomp+ssl transport connector in the ActiveMQ configuration file and my basic Python STOMP client is below: import time import sys import stomp class MyListener(stomp.ConnectionListener): def on_error(self, headers, message): print('received an error "%s"' % message) def on_message(self, headers, message): print('received a message "%s"' % message) conn = stomp.Connection() conn.set_listener('', MyListener()) conn.start() conn.connect('admin', 'password', wait=True) conn.subscribe(destination='/queue/test',

Spring Stomp @SendToUser with unauthenticated user not working

我的梦境 提交于 2019-12-04 09:48:51
问题 I'm trying to respond to an unauthenticated user using @SendToUser . Spring 4.1.1 I'm using a newly created Spring Boot application and the only config I have is: @Configuration @EnableWebSocketMessageBroker public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { @Override public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/stomp").withSockJS(); } @Override public void configureMessageBroker(MessageBrokerRegistry registry) {

How to secure websocket application [Spring boot + STOMP]

寵の児 提交于 2019-12-04 07:51:59
Good morning, I've created a simple Spring Boot WebSocket application. Right now I would like to set some security to it. I've trying some examples but I cannot get it worked. I'm getting error: web browser: >>> CONNECT ${_csrf.headerName}:${_csrf.token} accept-version:1.1,1.0 heart-beat:10000,10000 <<< ERROR message:Failed to send message to ExecutorSubscribableChannel[clientInboundChannel]; nested exception is org.springframework.security.web.csrf.MissingCsrfTokenException\c Could not verify the provided CSRF token because your session was not found. content-length:0 Log in STS: Failed to