stomp

Spring STOMP sending messages from anywhere in the application

跟風遠走 提交于 2019-12-04 07:25:21
I am building an application using Stomp to broker messages over websockets. I am trying to send messages from the server to the client without a request from anywhere in the application. I found two separate choices online for sending messages from anywhere in the application. The first is found in the Websocket documentation. Section 20.4.5: @Controller public class GreetingController { private SimpMessagingTemplate template; @Autowired public GreetingController(SimpMessagingTemplate template) { this.template = template; } @RequestMapping(value="/greetings", method=POST) public void greet

Spring 4 AbstractWebSocketMessageBrokerConfigurer With SockJS Not Negotiating Transport Properly

前提是你 提交于 2019-12-04 06:41:12
So I must say that all of the websocket tutorials/examples appear to be so easy, but it seems you really have to dig to find really important pieces of information that are left out of the simple examples. I'm stil having quite a few issues with my webapp using the Spring 4 Stomp message broker with SockJS on the front end. Currently, if I add an endpoint to the StompEndpointRegistry without enabling SockJS(), then declare my socket on the front end using dojo's dojox/socket, Firefox 28 will open a websocket just fine. However, I need support in IE8 and IE9, so I switched to SockJS. Using

Configure External Broker(RabbitMQ) In Spring4+STOMP+SockJS Application

依然范特西╮ 提交于 2019-12-04 05:32:08
I am working on a chat application developed using Spring4 Messaging and STOMP implemented with SockJS. The application works fine when I use the Simple Message Broker : config.enableSimpleBroker("/queue/", "/topic/"); But, now we have a requirement to use an external broker(RabbitMQ) with the same application. For that, I changed the above code with the following: // config.enableSimpleBroker("/queue/", "/topic/"); config.enableStompBrokerRelay("/queue", "/topic"); My client side is connecting using STOMP client as below: stompClient.connect({}, function(frame) { // subscribe to topics or

Spring session + Spring web socket. Send message to specific client based on session id

↘锁芯ラ 提交于 2019-12-04 04:16:40
问题 I have followed Quetion1 and Quetion2 from stack overflow to send messages to specific client, based on its sessionId but could not find success. Below is my sample RestController class @RestController public class SpringSessionTestApi { @Autowired public SimpMessageSendingOperations messagingTemplate; @MessageMapping("/messages") public void greeting(HelloMessage message, SimpMessageHeaderAccessor headerAccessor) throws Exception { String sessionId = (String) headerAccessor

STOMP or XMPP - Over websocket

扶醉桌前 提交于 2019-12-03 22:32:24
I am working on a project which involves real time chat (messaging, including group chats). I have worked with websockets before, So I started working on this using spring-websockets and I did some reading about what is the best way to implement it. Then I came across STOMP (as a sub-protocol for websockets)and as there is direct support for STOMP in spring it was bit easy to achieve what I was supposed to do. But my doubt is as far as my understanding STOMP and XMPP are similar protocols(messaging protocols) but I could not find any questions/blogs where the differences are explained and why

Send Notification to specific user in spring boot websocket

此生再无相见时 提交于 2019-12-03 16:21:50
问题 I want to send notification to specific client. e.g username user @Configuration @EnableWebSocketMessageBroker public class WebSocketConfiguration extends AbstractWebSocketMessageBrokerConfigurer { @Override public void registerStompEndpoints(StompEndpointRegistry stompEndpointRegistry) { stompEndpointRegistry.addEndpoint("/socket") .setAllowedOrigins("*") .withSockJS(); } @Override public void configureMessageBroker(MessageBrokerRegistry registry) { registry.enableSimpleBroker("/topic", "

Spring websocket with stomp security - every user can subscribe to any other users queue?

荒凉一梦 提交于 2019-12-03 14:43:32
I created a simple app that uses the websockets mechanism of spring 4. I use in my app an activemq broker. In my simple test i create 10 messages for a user named "Alejando" (user/alejandro/queue/greetings) When i log in with "Alejando" and subscribe to that queue: stompClient.subscribe('/user/alejandro/queue/greetings', function(greeting){ showGreeting(JSON.parse(greeting.body).content); }); I indeed receive all the 10 messages that were enqued for alejandro. The problem is when i log in with a different user named "evilBart" and subscribe to the queue of alejandro i receive the messages as

Websockets over HTTPS with spring boot 1.0.0.RC5 and tomcat 8.0.3

别来无恙 提交于 2019-12-03 12:00:51
问题 I have a working example of the web socket (ws) non secure implementation application using spring boot 1.0.0.RC5 and tomcat 8.0.3. Now i would like to switch to wss i.e. using my own self signed certificate that had been loaded by tomcat already. This question has two parts one theoretical and one practical: Theoretical => Do i need to have tomcat listening on two ports? i.e. on http and https. The reason i am asking this is because i read that during a web socket communication the first

How to send ERROR message to STOMP clients with Spring WebSocket?

泪湿孤枕 提交于 2019-12-03 11:56:06
问题 I am using Spring's STOMP over WebSocket implementation with a full-featured ActiveMQ broker. When users SUBSCRIBE to a topic, there is some permissions logic that they must pass through before being successfully subscribed. I am using a ChannelInterceptor to apply the permissions logic, as configured below: WebSocketConfig.java: @EnableWebSocketMessageBroker public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { @Override public void registerStompEndpoints

SimpMessagingTemplate.convertAndSend with RabbitMQ works very slow

拈花ヽ惹草 提交于 2019-12-03 11:21:32
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 WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { @Override void configureMessageBroker