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
7
votes
0 answers

Spring websockets without STOMP and SockJs but with message broker and routing support

Is there a way to use the facilities provided by Spring to have a webSocket connection without using SockJS and STOMP? I need to implement a proprietary webSocket protocol so I cannot use either one at the moment. I have implemented/hacked together…
Kaloyan Pashov
  • 155
  • 2
  • 11
7
votes
2 answers

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

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…
7
votes
0 answers

How do you copy stomp websocket sessions to redis in spring when you are using REST API and JWT

I am building a small websocket project and secured by JWT token mechanism and I would like to store websocket sessions in redis not local memory. @Override protected void configureStompEndpoints(StompEndpointRegistry registry) { registry …
Inacio
  • 127
  • 12
7
votes
1 answer

Spring Websocket Security throwing AccessDeniedException

Let me preface this by saying that access should be denied for my scenario. Built in Spring Boot with Spring Security 4. I'm allowing anyone to connect to the websocket and subscribe to a topic, but I'm securing the ability to send messages to the…
Trevor Bye
  • 686
  • 1
  • 6
  • 26
7
votes
0 answers

Invalid Sec-WebSocket-Accept response using react native client and Jetty Spring server

var ws = new WebSocket('ws://localhost:8080/activity/hello'); ws.onopen = () => { // connection opened ws.send('something'); // send a message }; ws.onmessage = (e) => { // a message was received console.log(e.data); }; ws.onerror…
Amish Shah
  • 111
  • 1
  • 3
7
votes
1 answer

SimpMessagingTemplate not sending messages to websocket

I have the following contoller @Controller public class GreetingController { @MessageMapping("/hello") @SendTo("/topic/greetings") public Person greeting(String message) throws Exception { Person person=new…
Afroz Shaikh
  • 362
  • 4
  • 18
7
votes
3 answers

Websocket keep track of connections in Spring

Today I've searched a couple of hours for an implementation or tutorial in how to keep track of websocket connections in Spring. I've done the (very good) Spring tutorial about websockets and STOMP. link here So what's my setup, I have an Ionic…
Sytham
  • 824
  • 3
  • 11
  • 25
7
votes
2 answers

Java SockJS Spring client and message size

Using SockJS java client, I am trying to connect to Spring sockjs server and is getting error 1009 for messages (without headers) of ~20Kb. Javascript library works fine. Transport closed with CloseStatus[code=1009, reason=The decoded text message…
onkami
  • 8,791
  • 17
  • 90
  • 176
7
votes
1 answer

Spring: send message to websocket clients

I'm building a webchat with Spring Boot, RabbitMQ and WebSocket as POC, but I'm stucked a the last point: WebSockets I want my ws clients to connect to a specific endpoint, like /room/{id} and when a new message arrives, I want the server to send…
Luiz E.
  • 6,769
  • 10
  • 58
  • 98
7
votes
1 answer

WebSocket dynamically add and remove Endpoints

I have created this Websocket project Spring Websocket and it works really fine. I will introduce this example in my project. There I have the requirement that (chat-) groups can dynamically be created or removed/destroyed. In my WebsocketConfig-…
quma
  • 5,233
  • 26
  • 80
  • 146
7
votes
4 answers

javax.servlet.ServletException: Not running on Jetty, JSR-356 support unavailable

I am facing a problem while deploying a war on to tomcat instance, Tomcat version details, D:\Kiran\Kiran\Softwares DH\Webservers\apache-tomcat-7.0.63\bin>version.bat Using CATALINA_BASE: "D:\Kiran\Kiran\Softwares…
Kiran Joshi
  • 746
  • 1
  • 11
  • 27
7
votes
2 answers

Why is ServletServerContainerFactoryBean casuing problems when testing?

I'm doing a web application using Spring Boot. This application is also configured to use WebSocket and handle (pretty basic) incoming messages. The application seems to work fine. The problem is when I'm doing some testing. The relevant parts are…
ccamcmxc
  • 491
  • 4
  • 12
7
votes
1 answer

Custom Stomp Headers using Spring websockets

I have a basic spring websocket application which currently sends basic data to subscribers. Currently the system uses the SimpMessageSendingOperations class as the message handler. If I call SimpMessageSendingOperations.convertAndSend(destination,…
Jaimie Whiteside
  • 1,180
  • 9
  • 21
6
votes
1 answer

No enum value sending message using websockets

I am trying to create a simple chat application using websockets. I followed this tutorial: https://www.baeldung.com/websockets-spring. This is my config: @Configuration @EnableWebSocketMessageBroker public class WebSocketConfig implements…
konradDos
  • 81
  • 1
  • 5
6
votes
0 answers

Spring - Integration test - cant connect to secured Websocket

I have a Spring Boot 2.2 MVC application with Spring-Security / Session and Spring-Websocket. It's configured to only allow websocket connections when authenticated. Following is the recommended way to create a Websocket Client in unit testing.…