Questions tagged [spring-websocket]

A Spring Framework module that support WebSocket-style messaging in web applications (native websocket and with SockJS support), including use of STOMP as an application level WebSocket sub-protocol.

This implementation supports the websocket protocol (RFC6455) and the Java websocket API (JSR-356), with fallback options using SockJS.

See:

1417 questions
8
votes
5 answers

Spring Websocket - How can I detect client disconnect

I am new to spring I have this class : public class Server extends TextWebSocketHandler implements WebSocketHandler { WebSocketSession clientsession; @Override public void handleTextMessage(WebSocketSession session, TextMessage…
Eli
  • 6,353
  • 9
  • 30
  • 25
8
votes
1 answer

Manually set transport type on a Spring + Sockjs application

I need to install an application on a non JEE7 compliant server. I am using Spring + Stomp + SocksJs for realtime notifications. My code looks like this: @Configuration @EnableWebSocketMessageBroker public class WebSocketConfig extends…
pallendes
  • 95
  • 1
  • 1
  • 9
8
votes
5 answers

Deploying a project on external Tomcat

I've followed the following Spring Web Sockets guide to create an application using Spring Web Sockets on stomp. https://spring.io/guides/gs/messaging-stomp-websocket/ The application works fine when I run it using the Spring Boot embedded Tomcat.…
user6461129
8
votes
0 answers

How Do You Configure The Spring Websocket STOMP Server Name?

I am a bit tired of seeing 'connected to server undefined' in the Chrome dev console. How do I give my server a name? @Configuration @EnableWebSocketMessageBroker public class WebsocketConfig extends AbstractWebSocketMessageBrokerConfigurer { …
8
votes
1 answer

How to close a STOMP websocket in a spring server

I am using spring-websocket and spring-messaging (version 4.2.2.RELEASE) to implement STOMP over websockets with a fully-featured broker (Apache ActiveMQ 5.10.0). My clients are meant to SUBSCRIBE to destinations only - that is they should should…
Nenad
  • 257
  • 3
  • 9
8
votes
1 answer

Use SimpMessagingTemplate without creating a web socket message broker Spring 4

Can I send a message to a message broker using SimpMessagingTemplate#convertAndSendToUser or SimpMessagingTemplate#convertAndSend methods without settings up a websocket message broker using @EnableWebSocketMessageBroker? What I'm trying to do is…
Susitha Ravinda Senarath
  • 1,648
  • 2
  • 27
  • 49
8
votes
4 answers

Spring Boot SSL TCPClient ~ StompBrokerRelayMessageHandler ~ ActiveMQ ~ Undertow

I'm attempting to build a websocket messaging app based on the Spring Websocket Demo running ActiveMQ as the STOMP message broker with Undertow. The application runs fine on insecure connections. However, I'm having difficulty configuring the STOMP…
Edward J Beckett
  • 5,061
  • 1
  • 41
  • 41
8
votes
0 answers

spring websocket - session closing after 60 sec

We are using websockets with apache-tomcat (8.0.15). The tomcat runs behind a HAProxy which has a timeout server 60s. We are using spring-websocket (4.1.4.RELEASE). Problem we are facing is that the sessions keep getting closed very frequently. We…
Amit Dalal
  • 642
  • 8
  • 20
8
votes
4 answers

Disallow broadcast in convertAndSendToUser method in SimpMessagingTemplate

I am working with Spring websocket implementation. For sending a message to clients, there are two ways: 1) Using @SendToUser annotation 2) Using convertAndSendToUser method of SimpMessagingTemplate @SendToUser takes a boolean parameter called…
Sunny Agarwal
  • 1,451
  • 4
  • 18
  • 36
8
votes
3 answers

How do I use convertAndSendToUser() with an external broker such as RabbitMQ in Spring4?

I am trying to configure web socket support in Spring 4 using RabbitMQ as the external broker, but as soon as I switch to RabbitMQ, I get the following error on start-up in the client: '/user/queue/changes' is not a valid destination. Valid…
Paul Drummond
  • 6,043
  • 6
  • 30
  • 38
7
votes
0 answers

How to handle internet connection loss in stompjs web socket

I am using stomp js in my angular project and also using WebSocket in java spring for backend. Here is the scenario where if internet connection is lost in the client pc then how to notify the client that they are disconnected from the WebSocket…
Hardik Siroya
  • 117
  • 2
  • 9
7
votes
1 answer

@SubscribeMapping vs @MessageMapping

When using websockets with Spring Boot I've seen examples that use: @Configuration @EnableWebSocketMessageBroker public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { @Override public void…
7
votes
0 answers

Is it possible to create many brokers on Spring Websocket configuration?

I have an application that require receive different types of messages from the server. I have created an approach that allows many simple brokers, but I can't find information if it is a good or correct way to use: @Override public void…
J. Gilson
  • 71
  • 2
7
votes
3 answers

Spring websocket send message from multiple threads

I'm using Spring WebSocket server implementation for one of my spring based projects. I faced an error saying The remote endpoint was in state [TEXT_PARTIAL_WRITING] which is invalid state. I found out the problem is writing to websocket from…
Sepehr GH
  • 1,297
  • 1
  • 17
  • 39
7
votes
0 answers

Spring bean @Scope "websocket" without @EnableWebSocketMessageBroker annotation

I have an spring boot app that is exchanging messages over binary websocket. I.e. NO STOMP, AMQP etc. or any other messaging protocol!!! Now I need to mark one of my classes with the Scope of "websocket". Like that…
Tito
  • 2,234
  • 6
  • 31
  • 65