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.
spring-websocket
1,477
questions
0
votes
1
answer
10
views
Spring 5 Websocket endpoint not reachable
I implemented a simple websocket endpoint in my Spring app (which is deployed in Tomcat) and I cannot reach it.
Configuration in my application context XML
<bean id="myWebSocketHandler" ...
-1
votes
1
answer
21
views
Custom Jetty WebSocketPolicy with Spring6 / Spring Boot 3 Web Sockets
In older versions of Spring, a custom policy could be applied by doing the following:
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig extends ...
0
votes
0
answers
20
views
SpringBoot - Websockets STOMP 1.2 - How to detect and log heart-beat from client and from server
How do I capture and log STOMP heart-beats sent by the clients and by the server?
I have SpringBoot configuration below for websockets using STOMP
@Configuration
@EnableWebSocketMessageBroker
public ...
0
votes
0
answers
8
views
Does Simple Broker auto deletes the message queue in Stomp Websocket?
I am new to learning Websockets and how they work.
In my implementation of Websocket using Springboot (React Client), I am using one connection
[ ws://localhost:8080/intl-moa/ws-endpoint (for eg)]
I ...
1
vote
0
answers
21
views
How can I broadcast a STOMP messages to all RabbitMQ servers?
I'm working in a multiserver environment. It uses Spring WebSocket and RabbitMQ as an external broker for STOMP.
My JavaScript clients send messages to one single backend server through a balancer. It ...
0
votes
0
answers
14
views
Spring 4.2.9 WebSocket server on WebLogic 12.2.1.4 -> 401 Unauthorized
I am trying to add a websocket endpoint to a Struts 2 + Spring Framework 4.29 web application deployed on a WebLogic 12.2 server that has to listen for text and binary data from a network scanner. But ...
1
vote
0
answers
44
views
Failed to instantiate [org.springframework.web.servlet.HandlerMapping]:Factory method 'stompWebSocketHandlerMapping' threw exce with message: null
I am recently upgrading the Java 11 to Java 21 and Spring Boot 2.x to Spring boot 3.2.5. Post migration I am end up with a Run-time Exception which I do not have any clue at all.
I am using ...
0
votes
3
answers
180
views
How to secure microservice websocket endpoint with Spring Cloud Gateway?
I have a microservice architecture based project, for which I have added Spring Cloud Gateway in front. My plan is to centralize security in the gateway. I have added OIDC and OAuth 2 for ...
0
votes
0
answers
29
views
@SendToUser does not work, but convertAndSendToUser works
@SendToUser doesn't send messages to given path, but convertAndSendToUser() do. I checked the client side and it subscribes correctly. I expect @SendToUser in RoomExceptionHandler to send errors when ...
0
votes
1
answer
74
views
Why is CSRF protection needed for connecting to websockets if Spring Security implements Same Origin Policy at server level?
As per Spring Security documentation, for websockets there is SOP implemented at the server level, as opposite to regular http where the browser implements SOP. However, Spring Security also requires ...
0
votes
0
answers
25
views
Issue Receiving WebSocket Notifications in a Spring Boot Application
I am working on a Spring Boot application using WebSocket for real-time user-specific notifications. Although the WebSocket connection is established and notifications are correctly sent from the ...
1
vote
0
answers
25
views
Not Receiving WebSocket Notifications in Spring Boot Application
I am currently working on a Spring Boot application that uses WebSockets for real-time communication. I have set up a notification system where notifications are sent to a specific user via WebSocket. ...
-1
votes
0
answers
31
views
CORS failure - Origin not matching
Hope all are well?
I have been trying to work with websockets implementation in Spring. I am running into an issue with CORS where the client is sending the origin header as http://localhost:3000 ...
1
vote
1
answer
25
views
How to deny preSend() in ChannelInterceptor based on custom check via DB call
Within my WebSocketConfig class:
@Configuration
@EnableWebSocketMessageBroker
class WebsocketConfig(<...>)
I override:
@Bean(name = ["csrfChannelInterceptor"])
fun ...
0
votes
0
answers
25
views
@SendToUser doesn't send message to user
I have a problem. I would be very happy if someone could help me with this. My Spring server successfully receives the message and sends a message to "/queue/private-messages", but my ...
0
votes
0
answers
41
views
WebSocket Chat Application in Spring Boot Not Receiving Messages in Postman
Problem Description:
I'm working on a WebSocket chat application using Spring Boot. The application uses STOMP over WebSocket for communication. When I test the WebSocket connection in Postman, I can ...
0
votes
0
answers
19
views
How to handle and replace message from SubProtocolWebSocketHandler in Spring Stomp Web Socket
I am using WebClientSocket library from Arduino and connect with Spring Boot Web Socket.
The issue occur when command send from microcontroller to web server socket.
STOMP command has end of string ...
0
votes
0
answers
18
views
Issue with Dynamically Configuring Streams in RabbitMQ with STOMP and WebSocket
I hope you are all well. I would like to share a problem I am facing in my messaging architecture.
Architecture:
Web clients: Connect to RabbitMQ using the STOMP protocol.
Exchange: Clients subscribe ...
0
votes
1
answer
84
views
Spring websocket connection closed by spring cloud gateway after 30 seconds
My application is a microservice application. I am using spring web sockets to send notifications to the front end. In my application, I have a gateway service to route the HTTP requests to the ...
0
votes
0
answers
15
views
Spring SimpleBroker and strange stomp Connected message
I'm working with Spring 6.0.9 and Stomp.
If I use RabbitMq as external Broker, the Stomp "CONNECTED" message looks like this:
message
(org.springframework.messaging.support....
0
votes
0
answers
40
views
Spring STOMP and ping/pong timing
I'm working with Spring STOMP and rabbit mq. I'm deepening some disconnections issues probably disposed by a reverse proxy server.
I would like to know how has in charge the ping/pong handling, is ...
0
votes
0
answers
37
views
How to send messages to specific user from service layer using spring boot web socket
I was trying to send messages to a specific user from the Spring Boot application service layer. My application is a microservice application. My requirement is,
when one of microservice send a ...
1
vote
0
answers
107
views
Amazon MQ as broker relay for Spring + Websocket + Stomp is not working
Im not able to connect to Amazon MQ(Active MQ) which i'm setting up as broker relay for web-socket connections over STOMP protocol.
Below are few of my configuration attempts
Environment:
Spring Boot ...
1
vote
2
answers
250
views
Websocket connection fails when adding Spring Boot Security
In a project, I have to implement a live chat between users. To do so I decided to use Websockets.
I currently have a frontend client written in React and a Spring boot backend written in Java.
The ...
0
votes
0
answers
44
views
When event is triggered, User comes as null, Spring Boot, Secure Websocket
Hello guys,
I have a weird problem with WebSocket in Spring Boot. Now, I am trying to authenticate the user when the user triggers an event from the client side (React, Typescript app); I have no ...
0
votes
0
answers
17
views
Angular can't access Springboot through Websockets
I'm having a porject, where Springboot is hosting the Angular frontend. The backend is receiving data from a external MQTT-Broker and is supposed to broadcast specific messages that it receives to an ...
1
vote
0
answers
20
views
Why does Webflux WebSocketHandler returned as a lambda expression share the response, but not when defined as a component
The following configuration that returns WebSocket#handle as a lambda expression shares the Entity to all browser connections.
@Bean
public WebSocketHandler webSocketHandler (ObjectMapper ...
1
vote
1
answer
64
views
Spring WebSocket: Discrepancy in CORS Behavior between XMLHttpRequest and Fetch Requests despite Credentials Set to False
I have configured Credentials to false in my Spring WebSocket application. However, when I request http://192.168.7.175/api/webSocketEndPoint/info?t=17139606, the response status is 200. Despite this, ...
0
votes
0
answers
33
views
404 error when trying to connect to the websocket (Angular + Spring boot)
In Angular i tried to connect to the websocket but an error message is returned :
websocket.service.ts:15 GET http://localhost:8081/socket.io/?EIO=4&transport=polling&t=OxuZ1WH 404 (Not Found)
...
0
votes
0
answers
44
views
I am trying to make a java websocketWhen I am trying to connect to websocket, I am getting following error : Request method 'GET' is not supported
Pom.Xml :
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&...
0
votes
1
answer
92
views
Angular implementing websocket using sockJs and Stomp getting CORS Error
I used Stomp and SockJS for implementing WebSocket, and our backend is built with Spring Boot.
this is my client code:
and baseApi is something like this:
baseApi: 'https://api.test.com'
this is ...
0
votes
0
answers
39
views
Failed to handle GenericMessage issue with WebSockets and MongoDB
I want to do simple chat service for my project, which has multiple input users but one end user who get messages from all of them.
I have such classes
@Service
public class ChatUserService {
...
0
votes
1
answer
66
views
spring multi tenant application with websockets?
I have a working spring multi tenant application. It uses the familiar construct of a thread local variable and a web filter, and uses the hostname (subdomain) to determine which tenant is active.
But ...
0
votes
0
answers
11
views
Strange random packet delay on client [Java Spring/Netty + WebSocket]
There is a server (Java Spring + Netty), there is a client in Javascript. The server and client communicate via sockets. The server sends packets (about 200 bytes each) to the client at a fixed ...
0
votes
0
answers
50
views
Can't get Stomp JS client to subscribe to my backend websocket built using spring boot
I am trying to build a chat application where the frontend is built using HTML, CSS, JS, and the websockets handling in the backend is built using Java spring boot.
The below is my client code.
...
0
votes
0
answers
18
views
Websocket - Client is still with https-200 even though server have successfully upgraded the connection and shared back 101 response
I am having an application using websocket for communication but randomly observing that the browser is still with https & status 200 instead of 101, even though the handshake is successful and ...
0
votes
0
answers
38
views
Websocket request is ignored in Spring gateway security
I have a problem with connecting spring WebSocket(Using sockJs).
Currently, we are using a gateway service(written in spring boot) to redirect incoming requests to appropriate micro-services. But I ...
1
vote
0
answers
19
views
Stomp over websocket , data not receiving to the client
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
...
0
votes
1
answer
145
views
Spring WebSocket upgrade failure. response 400 BAD_REQUEST
I have an Spring app with Stomp WebSocket but when i try to connect to it using Postman or wscat i get an "error : Unexpected server response : 400"
Here is configurating code i use :
In ...
0
votes
0
answers
58
views
WebSocket session using org.springframework.web.socket vs org.springframework.web.reactive.socket
I have a working WebSocket session based on org.springframework.web.socket where the method handleTextMessage is overridden and receives the payload successfully
When trying to do something similar ...
-1
votes
1
answer
51
views
Spring Websocket CORS issue
I have a web application served by an Angular frontend and Spring Boot backend. They are deployed with a multi-stage Docker build on the same server. I had an issue of the websocket on Angular not ...
0
votes
0
answers
21
views
When i reload or logout from my app the disconnect function in the backend runs twice and i am getting two session different ids when logging out
I am developing an application where there is a chat feature and I am facing a problem. When I logout from the app, I see two disconnects from two different session ids for the same user.
The output ...
0
votes
0
answers
58
views
Websocket duplicate on headers
I'm doing a migration from a monolith to microservices on a springboot web application, there is a service about websocket but I can't connect when I'm doing the migration. This code still work in ...
1
vote
1
answer
68
views
Spring boot websocket chat(stomp) receive function didnt works
I'm currently implementing websockets with stomp
However, the send function works on the frontend, but I can't receive it on the server side.
SEND
destination:/app/chatAddUser
content-length:15
...
-1
votes
1
answer
195
views
Java WebSocket client memory leak
I have an application that runs multiple client socket connections. I've noticed that when I send thousands of messages simultaneously, it occasionally generates a memory leak. What could it depend on?...
0
votes
0
answers
47
views
React Native and WebSocket communication - StompJS will not connect for me, alternatives?
I have a springboot application that is hosting my websocket endpoints, I can connect to the endpoints and subscribe to a specific topic and get the results perfectly fine using React and StompJS and ...
0
votes
0
answers
31
views
Having problem with sending message to the Client-Side
I'm using WebSocketMessageBrokerConfigurer on Java Spring. I need to print a message on the client side that is subscribed to server every time I send request to this API routes:
@PostMapping("/...
0
votes
0
answers
40
views
CORS issues when connecting to a WebSocket for SpringBoot + React projects
im trying to implement a collaborative whiteboard using a spring boot.
so i created WebMvcConfig and applied cors settings.
import org.springframework.context.annotation.Configuration;
import org....
0
votes
0
answers
19
views
How to find all subscribed clients to a web socket destination in spring boot?
I have a backend running on the spring boot. I have two destinations in my application /user and /queue. I want to print every subscriber on the screen whenever a client subscribes to the /queue.
-1
votes
1
answer
35
views
Unable to hit the websocket endpoint from frontend
I am writing have configured websocket endpoint using below given code at backend part. And I created a endpoint in controller. Now I am hitting the url from front end but the controller method is not ...