stomp

Spring 4 STOMP Websockets Heartbeat

眉间皱痕 提交于 2019-12-07 03:09:33
问题 I can't seem to find a good resource on how to send heartbeats to clients using websockets in Spring! I have a basic server running using this configuration: @Configuration @EnableWebSocketMessageBroker public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { @Override public void configureMessageBroker(MessageBrokerRegistry config) { config.enableSimpleBroker("/room"); config.setApplicationDestinationPrefixes("/app"); } @Override public void registerStompEndpoints

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

断了今生、忘了曾经 提交于 2019-12-07 01:32:45
问题 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

How to add custom headers to STOMP CREATED message in Spring Boot application?

有些话、适合烂在心里 提交于 2019-12-06 21:31:26
I'm trying to add custom headers to the STOMP 'CREATED' message, which is received by client at the first connection. Here is the function which connects to the WebSocket using STOMP JavaScript: function connect() { socket = new SockJS('/chat'); stompClient = Stomp.over(socket); stompClient.connect('', '', function(frame) { whoami = frame.headers['user-name']; console.log(frame); stompClient.subscribe('/user/queue/messages', function(message) { console.log("MESSAGE RECEIVED:"); console.log(message); showMessage(JSON.parse(message.body)); }); stompClient.subscribe('/topic/active', function

How configure the Spring Sockjs Java Client message converters

我怕爱的太早我们不能终老 提交于 2019-12-06 12:19:20
I have one SockJS Java client that use STOMP. Is base on this https://github.com/rstoyanchev/spring-websocket-portfolio/blob/master/src/test/java/org/springframework/samples/portfolio/web/load/StompWebSocketLoadTestClient.java . My code: package mx.intercommunication.websocket.stompclient; import org.springframework.messaging.converter.StringMessageConverter; import org.springframework.messaging.simp.stomp.StompCommand; import org.springframework.messaging.simp.stomp.StompHeaders; import org.springframework.messaging.simp.stomp.StompSession; import org.springframework.messaging.simp.stomp

ActiveMQ - STOMP+SSL with Python STOMP client

青春壹個敷衍的年華 提交于 2019-12-06 07:45:31
问题 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(

How do I connect a STOMP client to Wildfly?

时光总嘲笑我的痴心妄想 提交于 2019-12-06 06:21:21
问题 I would like to expose my WildFly server to STOMP clients but I have not found any recent samples. As I understand it all communication in recent WildFly versions goes through a single socket (listening to 8080 by default). Do I need to change any configuration or is it supported out of the box? Any pointers are appreciated. 回答1: It's true WildFly only listens on port 8080 by default (plus port 9990 for management), using HTTP protocol upgrade to switch to different protocols. However, you

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

假装没事ソ 提交于 2019-12-06 02:05:20
问题 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

Whoops! Lost connection to undefined - Connection Lost Just After The Connection Established

大城市里の小女人 提交于 2019-12-06 00:34:55
For Last couple of days i have been trying spring 4 websocket . But There is a problem I am using apache-tomcat-8 and this is not a maven project. Here are my snippets index.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %> <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html>

Spring 4 WebSockect over STOMP Authentication

爷,独闯天下 提交于 2019-12-05 21:07:51
I'm developing a multiplayer game based on Spring 4 WebSocket. my server is stateless so in order to identify players i use tokens. after struggling for sometime with how to identify players over WebSockets i came up with this solution: on the client player registers like this: var sockjs = new SockJS("http://mygame/games/", null, {server : token}); this adds the token to the url, I have set up a filter using spring security: String requestURI = request.getRequestURI(); String[] parts = StringUtils.split(requestURI, "/"); if (parts.length == 4) { String token = parts[1]; List<GrantedAuthority>

Websocket java client Spring + Stomp: Transport error: ConnectionLostException

泄露秘密 提交于 2019-12-05 20:06:24
I'm trying to create an standalone Java app as a websocket client using for this Spring with Stomp and Sockjs, taking in consideration the spring specifications and the spring-portafolio examples and I'm getting this error: 15:18:01.342 [main] DEBUG com.example.client.WebSocketClientTest - Connecting to : ws://localhost:8080/socket/hello 15:18:01.541 [WebSocketClient-AsyncIO-1] ERROR com.example.client.MyStompSessionHandler - Transport error org.springframework.messaging.simp.stomp.ConnectionLostException: Connection closed at org.springframework.messaging.simp.stomp.DefaultStompSession