spring-websocket

SubProtocolWebSocketHandler - No handlers

对着背影说爱祢 提交于 2020-01-03 04:40:06
问题 I have this ugly error during deploying Spring app on JBoss. 18:11:16,025 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/consumer]] (MSC service thread 1-7) Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.context.ApplicationContextException: Failed to start bean 'subProtocolWebSocketHandler'; nested exception is java.lang.IllegalArgumentException: No handlers at org

Spring websocket example - error - Are you running in a Servlet container that supports J SR-356?

半腔热情 提交于 2020-01-03 03:58:12
问题 I am trying to run the Spring 4 example given @ https://spring.io/guides/gs/messaging-stomp-websocket. When I try to connect to socket, it throws me following exception. As per the example you need tomcat 7.0.50 and I checked the executable jar which has right version of tomcat. Any pointer would be helpful. java.lang.IllegalArgumentException: No 'javax.websocket.server.ServerContainer' ServletContext attribute. Are you running in a Servlet container that supports JSR-356? 回答1: Check that you

SockJS Python Client

六月ゝ 毕业季﹏ 提交于 2020-01-01 08:52:07
问题 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 we would like to add some of the functionality which is already available using websockets. Does anyone knows how to use a python client so I can connect using the SockJS protocol ? PS_ I am aware of a simple library which I did not tested but it does not have the capability to subscribe to a

Spring Stomp @SubscribeMapping(“/user/…”) with User Destination doesn't work

爷,独闯天下 提交于 2020-01-01 08:08:12
问题 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 then send them to that user. Working code: Client code: stompClient.subscribe('/user/messages', function(msg){ alert(msg.body); }); Server code: template.convertAndSendToUser(p.getName(), "/messages", "message content"); What I need: It seems like it

How to correctly implement a spring-websocket java client

痞子三分冷 提交于 2020-01-01 04:43:11
问题 I am working on a Spring WebSocket Stomp Client for my WebSocket Server and I am getting conflicting information. I have found 2 ways to get it to work and without going into too much detail I was wondering which way is considered the "correct" way of implementing the client. Could somebody help me understand what the WebSocketConnectionManager is for? Also, one more question, how do I keep the websocket connection open and the program running to accept new messages without having to write

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

谁说我不能喝 提交于 2019-12-31 13:28:10
问题 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 HelloMessage greeting(HelloMessage message) throws Exception { Thread.sleep(3000); // simulated delay return message; } Can any one help me for who to call @SendTo("/topic/greetings") from normal api controller.I have try using this but it is not working for me

Spring 4 websocket + Tomcat 7.54 async-supported not working

偶尔善良 提交于 2019-12-29 07:54:30
问题 I am creating a sample chat application using the Spring websockets and stomp.js , I am using the tomcat 7.54 but while runing the application I am gettting a async-supported error when browser is making xhr request. Server info: Apache Tomcat/7.0.54 Servlet version: 3.0 JSP version: 2.2 Java version: 1.7.0_25 Web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=

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

你说的曾经没有我的故事 提交于 2019-12-28 05:33:09
问题 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 回答1: I met the same problem with nginx https proxy to tomcat. This is because I haven't support the wss request. To support the wss request, I use the config like below: # WebSocketSecure SSL Endpoint # # The proxy is also an SSL endpoint for WSS and HTTPS connections. # So the clients can use wss:// connections # (e.g

Spring websockets SockJS fallback protocols are not working out of the box?

放肆的年华 提交于 2019-12-24 07:15:27
问题 I've made an app with spring boot with websockets support. Everything is working great. I'm using SockJS + Stomp . No worries. It's just working. But now I want to support the ability of SockJS use its fallback protocols. And it seems that it's not working out of the box. Here's how I added the endpoint: @Override public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/ws").withSockJS(); } And that's it. No more configuraion. And now when I disable

Extracting Remote endpoint Object from Spring websocket session

巧了我就是萌 提交于 2019-12-24 01:13:25
问题 In javax websockets we can use something like the follows Session.getAsyncRemote().sendText(String text) Session.getBasicRemote().sendText(); How can we send an asynchronous messages using spring websocket. From WebSocketSession of spring webscockets can we extract RemoteEndPoint and send an async messages PS Note: I am using Basic Spring websockets... The configuration and code is as follows: @Configuration @EnableWebMvc @EnableAspectJAutoProxy @EnableWebSocket public class WebMVCConfig