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
Filter by
Sorted by
Tagged with
104 votes
6 answers
86k views

Sending message to specific user on Spring Websocket

How to send websocket message from server to specific user only? My webapp has spring security setup and uses websocket. I'm encountering tricky problem trying to send message from server to specific ...
gerrytan's user avatar
  • 40.7k
98 votes
3 answers
36k views

What are the pitfalls of using Websockets in place of RESTful HTTP?

I am currently working on a project that requires the client requesting a big job and sending it to the server. Then the server divides up the job and responds with an array of urls for the client to ...
smuggledPancakes's user avatar
96 votes
4 answers
72k views

How WebSocket server handles multiple incoming connection requests?

According to here: The HTTP Upgrade header requests that the server switch the application-layer protocol from HTTP to the WebSocket protocol. The client handshake established a HTTP-on-TCP ...
smwikipedia's user avatar
  • 63.1k
79 votes
3 answers
130k views

Shall I use WebSocket on ports other than 80?

Shall I use WebSocket on non-80 ports? Does it ruin the whole purpose of using existing web/HTTP infrastructures? And I think it no longer fits the name WebSocket on non-80 ports. If I use WebSocket ...
smwikipedia's user avatar
  • 63.1k
49 votes
5 answers
30k views

Does Spring @SubscribeMapping really subscribe the client to some topic?

I am using Spring Websocket with STOMP, Simple Message Broker. In my @Controller I use method-level @SubscribeMapping, which should subscribe the client to a topic so that the client would receive the ...
Mert Mertce's user avatar
  • 1,634
46 votes
5 answers
40k views

Spring WebSocket @SendToSession: send message to specific session

Is it possible to send a message to specific session? I have an unauthenticated websocket between clients and a Spring servlet. I need to send an unsolicited message to a specific connection when an ...
Tobia's user avatar
  • 9,265
45 votes
3 answers
27k views

Where "user" comes from in convertAndSendToUser works in SockJS+Spring Websocket?

I would like to understand how convertAndSendToUser works in Spring SockJS+Websocket framework. In client, we would connect as stompClient.connect(login, password, callback()) which will result in ...
onkami's user avatar
  • 9,091
39 votes
6 answers
82k views

I get a status 200 when connecting to the websocket, but it is an error?

My error shows up in the console of my browser: "WebSocket connection to 'ws://localhost:32768/DspClusterWebServices/myHandler' failed: Unexpected response code: 200" I am using Spring Websockets 4....
smuggledPancakes's user avatar
37 votes
5 answers
51k views

Spring WebSocket: Handshake failed due to invalid Upgrade header: null

I am using wss (secured web sockets) with spring from backend and STOMP for javascript client. Does anyone knows why a get: Handshake failed due to invalid Upgrade header: null
mspapant's user avatar
  • 1,900
36 votes
2 answers
12k views

How to reject topic subscription based on user rights with Spring-websocket

I'm implementing a version of the stock application where the server able to reject topic subscription for certain topic based on the user rights. Is there a way in spring-websocket to do this? For ...
tomikiss's user avatar
  • 969
36 votes
7 answers
38k views

Disconnect client session from Spring websocket stomp server

I've searched quite a bit and been unable to find this: Is there a way that a spring websocket stomp server can disconnect a client based on the sessionId (or really based on anything at all)? It ...
user1751547's user avatar
  • 2,281
33 votes
3 answers
20k views

Spring Websocket in a tomcat cluster

In our current application, we use Spring Websockets over STOMP. We are looking to scale horizontally. Are there any best practices on how we should handle websocket traffic over multiple tomcat ...
Robin Varghese's user avatar
33 votes
2 answers
48k views

How to send message to client through websocket using Spring

I try to use Spring with websocket. I started my investigation with this tutorial. In my side client I have something like that to initialize the connection to the server : function connect() { ...
cheb1k4's user avatar
  • 2,326
32 votes
6 answers
39k views

Spring Boot Websockets in Wildfly

Hi I need to deploy my Spring Boot app into Wildfly 8.1 and I'm getting the following exception: Caused by: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.tomcat.websocket....
Chris Stier's user avatar
31 votes
4 answers
14k views

Connect with iOS and Android clients to SockJS Backend

I'm developing WebSocket messaging backend using Spring WebSockets, which uses SockJS + STOMP protocol. The reason why not to use plain WebSockets is because I will need to leverage security ...
Maksim's user avatar
  • 16.7k
25 votes
3 answers
15k views

Stomp.js is out of date and no longer maintained - which Stomp client to use with Spring Websockets?

I found it surprising that the current documentation for the Spring WebSocket Support directs users to use stomp.js for their client-side JavaScript implementation. This project, on the ReadMe on it's ...
rikoe's user avatar
  • 1,659
24 votes
1 answer
4k views

Partial messages with SockJS in Spring-Websockets 4.2

I am using Spring-Websockets 4.2 with SockJS. Since the messages received by clients can be quite large, I would like to use partial messages. My subclass of TextWebSocketHandler does override ...
Jan's user avatar
  • 241
23 votes
2 answers
43k views

Error during WebSocket handshake: Unexpected response code: 403

I have implemented WebSockets with Spring Boot Application and have the below error message when trying to test the ws connection with the chrome extension 'Smart websocket client'. However, I have ...
M.Bel's user avatar
  • 233
21 votes
1 answer
19k views

Multiple rooms in Spring using STOMP

Is it possible to create rooms with STOMP and Spring 4? Socket.IO has rooms built in, so I'm wondering if Spring has this My code at the moment: @MessageMapping("/room/greet/{room}") @SendTo("/room/{...
Dolan's user avatar
  • 1,589
21 votes
3 answers
21k views

Difference between /topic, /queue for SimpleMessageBroker in Spring Websocket + SockJS

Is there a clarification, what is the differences between /topic, /queue etc. for Spring Websocket + SockJS in case I am using "simple broker" ? E.g. here Sending message to specific user on Spring ...
onkami's user avatar
  • 9,091
21 votes
3 answers
10k views

Sending images/files over Sockjs + Spring Websocket + Stomp

I am working on a messaging application using Spring websockets(STOMP as a sub-protocol) and Sockjs. I should provide support to send files in messages. According to this ticket, sockjs does not ...
Karthik's user avatar
  • 5,000
20 votes
1 answer
3k views

STOMP or XMPP - Over websocket

I am working on a project which involves real time chat (messaging, including group chats). I have worked with websockets before, So I started working on this using spring-websockets and I did some ...
Karthik's user avatar
  • 5,000
20 votes
1 answer
3k views

Redirecting websocket communication from client to a server to another websocket server

I already have a SimpleBrokerWebsocket implementation. Now I am migrating towards microservices based architecture and trying to create messaging as a separate microservice. To avoid breaking ...
Vivek's user avatar
  • 336
20 votes
1 answer
16k views

How to find all users subscribed to a topic in spring websockets

When making something like a chat application using Spring Websockets, it is useful to know who all is subscribed to any given topic. For, e.g. presence data displayed in the clients. I know that I ...
npskirk's user avatar
  • 1,188
19 votes
4 answers
21k views

Spring Async issue when upgrading from 4.2.0.RC3 to 4.2.0.RELEASE

I've a web application using the spring(4.2.x) artifacts spring-webmvc, spring-messaging, spring-websocket I've the below @Enable* annotations in my spring config java class @EnableWebMvc @...
Subham Saha's user avatar
19 votes
1 answer
2k views

Connecting to Stomp over WebSockets implemented using Spring 4 from Java client

I received a Web application, implemented with Spring using STOMP over WebSockets Messaging, similar to what's described here (with RabbitMQ at the backend). It runs on Tomcat, and I can connect to ...
timbre timbre's user avatar
18 votes
2 answers
34k views

Spring websocket send to specific people

I have added custom token based authentication for my spring-web app and extending the same for spring websocket as shown below public class WebSocketConfig extends ...
BiJ's user avatar
  • 1,679
18 votes
3 answers
21k views

Spring 4 websocket without STOMP,socketjs

I am trying to test websocket without using socketjs library and also i don't want to add any stomp connection. I am following the example from stackoverflow question: WebSocket with Sockjs & ...
melihcoskun's user avatar
17 votes
5 answers
16k views

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 ...
kentobi's user avatar
  • 491
17 votes
2 answers
16k views

Send Notification to specific user in spring boot websocket

I want to send notification to specific client. e.g username user @Configuration @EnableWebSocketMessageBroker public class WebSocketConfiguration extends ...
naila naseem's user avatar
17 votes
2 answers
24k views

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 = "/...
anandaravindan's user avatar
17 votes
2 answers
7k views

Spring websocket (WSS) with angular sockjs (HTTPS) over secure web socket server (tomcat)

I'm working on sending messages from the server side to angular client application using Spring web socket + stomp + SockJsClient at server side and SockJS at the angular side. My Socket server is a ...
John Martin's user avatar
17 votes
1 answer
5k views

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 @...
Lukasz Ciesluk's user avatar
16 votes
3 answers
17k views

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, ...
jordan.baucke's user avatar
16 votes
2 answers
7k views

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 ...
Mritunjay's user avatar
  • 25.6k
16 votes
1 answer
5k views

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") ...
Charnjeet Singh's user avatar
16 votes
1 answer
10k views

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 ...
Benjamin M's user avatar
  • 24.2k
16 votes
2 answers
15k views

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-...
Adam's user avatar
  • 36.3k
16 votes
2 answers
13k views

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 ...
hartz89's user avatar
  • 669
16 votes
2 answers
18k views

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 @...
JB Nizet's user avatar
  • 685k
15 votes
2 answers
4k views

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,...
Guy Schalnat's user avatar
  • 1,697
14 votes
3 answers
17k views

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 ...
stacktrace's user avatar
14 votes
1 answer
4k views

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 ...
vitalyster's user avatar
  • 5,078
13 votes
3 answers
28k views

How to get Session Id in Spring WebSocketStompClient?

How to get session id in Java Spring WebSocketStompClient? I have WebSocketStompClient and StompSessionHandlerAdapter, which instances connect fine to websocket on my server. WebSocketStompClient use ...
Irina's user avatar
  • 1,067
13 votes
5 answers
16k views

How to increase output buffer for spring sockjs websocket server implementation

I have used spring implementation of sockjs websocket server and unable to transmit message over 8KB, following is the error 2014-02-12 19:36:29,990 - org.springframework.web.socket.sockjs.transport....
cpandey05's user avatar
  • 1,261
13 votes
3 answers
9k views

Spring boot Websocket without SockJS

I have been struggling with this for at least two weeks now. I'm pretty new to websockets. I have good experience with rest endpoints. My use case is simple. Client initiates a websocket connection ...
Manikdn84's user avatar
  • 405
13 votes
3 answers
14k views

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('/...
Morteza Malvandi's user avatar
13 votes
1 answer
12k views

Why does sockJS add a '/info' to a given websocket url path

I want to open a websocket port with a "webapp/socket.do" path. When I use SockJS and try to initiate the call by code var socket = new SockJS('/webapp/socket.do'); stompClient = Stomp.over(...
Lihkinisak's user avatar
13 votes
2 answers
7k views

SockJS Python Client

I have a website (Java + Spring) that relies on Websockets (Stomp over Websockets for Spring + RabbitMQ + SockJS) for some functionality. We are creating a command line interface based in Python and ...
Tk421's user avatar
  • 6,346
13 votes
1 answer
3k views

STOMP vs WAMP over Spring-WebSockets

I am currently working on a project that needs to work with WebSockets. The clients will be the browsers only, so not interested in any message broker feature of these two. Although I don't think ...
AliR's user avatar
  • 2,065

1
2 3 4 5
30