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:

1267 questions
93
votes
5 answers

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 user only. My understanding from reading the…
gerrytan
  • 37,387
  • 8
  • 78
  • 91
82
votes
2 answers

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 make a GET call on and stream back the data. I am…
smuggledPancakes
  • 8,687
  • 18
  • 64
  • 104
70
votes
3 answers

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 over other ports, why not just use TCP directly?…
smwikipedia
  • 52,824
  • 76
  • 267
  • 432
70
votes
4 answers

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 connection between IE10 and server. After the server…
smwikipedia
  • 52,824
  • 76
  • 267
  • 432
42
votes
5 answers

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 messages of that topic afterwards. Let say, the…
Mert Mertce
  • 1,494
  • 2
  • 18
  • 28
41
votes
5 answers

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 async job ends. @Controller public class…
Tobia
  • 8,015
  • 24
  • 90
  • 182
38
votes
6 answers

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.1.5 and Tomcat 8.0.18. My WebSocketConfigurer…
smuggledPancakes
  • 8,687
  • 18
  • 64
  • 104
35
votes
3 answers

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 connect request with "Stomp credentials" of login…
Askar Ibragimov
  • 6,494
  • 15
  • 65
  • 132
33
votes
2 answers

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 example: In the stock example project we have…
31
votes
4 answers

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 integration that SockJS provides in Spring WebSockets and…
Maksim
  • 16,162
  • 25
  • 91
  • 128
28
votes
3 answers

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 instances and how can we maintain session info across…
Robin Varghese
  • 413
  • 1
  • 5
  • 10
28
votes
5 answers

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.server.WsServerContainer cannot be cast to…
Chris Stier
  • 281
  • 1
  • 3
  • 5
27
votes
7 answers

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 seems to me that once a client connects to a server…
user1751547
  • 1,821
  • 3
  • 16
  • 25
25
votes
2 answers

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() { var socket = new SockJS('/myphotos/form'); …
cheb1k4
  • 1,920
  • 5
  • 21
  • 37
23
votes
3 answers

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
  • 1,623
  • 1
  • 20
  • 28
1
2 3
84 85