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
17
votes
1 answer

Spring Websocket with Stomp full featured broker and failover

I have those configuration for spring and a full feature stomp broker (ActiveMQ): @Configuration @EnableWebSocketMessageBroker public class WebsocketConfig extends AbstractWebSocketMessageBrokerConfigurer { private static Logger LOG =…
Raphael do Vale
  • 931
  • 2
  • 11
  • 28
17
votes
1 answer

Spring Security with WebSockets - Forbidden 403

I have implemented WebSocket in Spring. Everything worked fine, but recently I decided to implement Spring Security. My MessageBroker looks like : @Configuration @EnableWebSocketMessageBroker @Component("messageBroker") public class MessageBroker…
17
votes
5 answers

Spring Websockets @SendToUser without login?

I have a simple spring application with websocket functionality and everything works so far. Now I want to send a message from my server to a specific client using the @SendToUser annotation. This gives me the error "Ignoring message, no principal…
16
votes
2 answers

Webflux websocketclient, How to send multiple requests in same session[design client library]

TL;DR; We are trying to design a WebSocket server using spring webflux WebSocket implementation. The server has usual HTTP server operations e.g. create/fetch/update/fetchall. Using WebSockets we were trying to expose one endpoint so the clients…
Mritunjay
  • 25,338
  • 7
  • 55
  • 68
16
votes
3 answers

Spring STOMP over WebSockets not scheduling heartbeats

We have a Spring over WebSockets connection that we're passing a CONNECT frame: CONNECT\naccept-version:1.2\nheart-beat:10000,10000\n\n\u0000 Which the handler acknowledges, starts a new session, and than…
jordan.baucke
  • 4,308
  • 10
  • 54
  • 77
16
votes
1 answer

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

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…
hartz89
  • 669
  • 1
  • 6
  • 18
16
votes
1 answer

How to call @SendTo from Normal Request Call i.e @RequestMapping

I have implemented Web Socket using Spring MVC and it is working fine for me i.e work from one browser to another browser which is open for those socket using this code. @MessageMapping("/hello") @SendTo("/topic/greetings") public…
Charnjeet Singh
  • 3,056
  • 6
  • 35
  • 65
16
votes
2 answers

Spring websocket getting 404 not found

I am trying to create an websocket endpoint with spring. But Whenever I am trying to connect from the client end, I get 404. I also have an Java implementation with @ServerEndpoint(value = "/websocket") which works good. Below is the code of my…
anandaravindan
  • 2,401
  • 6
  • 25
  • 35
16
votes
1 answer

Spring Stomp @SubscribeMapping("/user/...") with User Destination doesn't work

I need to react on a user destination subscription. Example: A user subscribes to /user/messages, because he wants to receive all incoming messages. Now I'd like to look up any messages for this user, which were created while he was offline, and…
Benjamin M
  • 23,599
  • 32
  • 121
  • 201
16
votes
2 answers

How to get/set the principal and session attributes from Spring 4 stomp websocket methods

I'm doing experiments with Spring 4 websockets and stomp, and I have a hard time figuring out how to get/set the current user and other session attributes in a message handling method annotated with @MessageMapping. The documentation says that the…
JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
15
votes
2 answers

Replying multiple times over web-socket without spring authentication

Note: see update at the bottom of the question for what I eventually concluded. I need to send multiple responses to a request over the web socket that sent the request message, the first one quickly, and the others after the data is verified…
Guy Schalnat
  • 1,697
  • 15
  • 26
15
votes
2 answers

Is it possible to send binary data with STOMP over WebSockets using Spring-WebSockets?

I am able to send and receive JSON with STOMP over WebSockets following spring documentation. However performance is poor at large high rates, so I wish to profile the use of binary messages. Spring-WebSockets 4.0 JavaScript client running in…
Adam
  • 35,919
  • 9
  • 100
  • 137
14
votes
1 answer

Handle the same URL with Spring MVC RequestMappingHandlerMapping and Spring Websocket's ServletWebSocketHandlerRegistry

What do I want to have: Client sends GET / HTTP/1.1(without Connection: upgrade) - this request should be handled by RequestMappingHandlerMapping Client sends Connection: upgrade along with GET request - this request should be handled by…
vitalyster
  • 4,980
  • 3
  • 19
  • 27
14
votes
3 answers

WebSocketStompClient won't connect to SockJS endpoint

I'm playing around with the new (as of version 4.2) java STOMP client support. My starting point is the getting started guide (Using WebSocket to build an interactive web application). The following endpoint is provided in the…
stacktrace
  • 547
  • 1
  • 6
  • 19
13
votes
3 answers

How to send custom message to custom user with spring websocket?

I'm new to spring websocket. I want to send product changes to clients. For this, I want to do it as follows: Client creates a socket connection and subscribes destination: var socket = new SockJS('/websocket'); var stompClient =…
Morteza Malvandi
  • 1,656
  • 7
  • 30
  • 73
1 2
3
94 95