spring-websocket

Webflux websocketclient, How to send multiple requests in same session[design client library]

天涯浪子 提交于 2019-12-20 18:46:11
问题 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 were trying to expose one endpoint so the clients could leverage a single connection for all sort of operations, given WebSockets are meant for this purpose. Is it a right design with webflux and WebSockets? Long Version We are starting a project which is going to use reactive web sockets from

WebSocketStompClient won't connect to SockJS endpoint

梦想与她 提交于 2019-12-20 12:20:52
问题 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 endpoint is provided in the example: @Override public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/hello").withSockJS(); } I can successfully connect using the browser client. When attempting to connect to this endpoint using the java stomp client using the

Enabling Cross Origin Requests for WebSockets in Spring

纵饮孤独 提交于 2019-12-20 10:57:54
问题 I have a OpenShift Wildfly server. I am building a website with the Spring MVC framework. One of my webpages also uses a WebSocket connection. On the server side, I have used the @ServerEndpoint annotation and javax.websocket.* library to create my websocket: package com.myapp.spring.web.controller; import java.io.IOException; import javax.websocket.OnClose; import javax.websocket.OnError; import javax.websocket.OnMessage; import javax.websocket.OnOpen; import javax.websocket.Session; import

Connect with iOS and Android clients to SockJS Backend

廉价感情. 提交于 2019-12-20 09:28:27
问题 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 also other neat features from SockJS, such as rooms, subscriptions, etc. I was wondering if this is a good option to use so that mobile (iOS and Android) and Web client apps can easily connect to the backend server and perform messaging. If yes,

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

一世执手 提交于 2019-12-20 08:29:15
问题 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 client subscribes to the topic "chat" : stompClient.subscribe('/app/chat', ...); As the client subscribed to "/app/chat ", instead of "/topic/chat" , this subscription would go to the method which is mapped using @SubscribeMapping :

spring websockets: sending a message to an offline user - messages not enqueued in message broker

徘徊边缘 提交于 2019-12-20 02:34:30
问题 I have a webapp with spring and websockets using a message broker (activemq). here is my config class: @Configuration @EnableWebSocketMessageBroker @EnableScheduling public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { @Override public void configureMessageBroker(MessageBrokerRegistry config) { config.enableStompBrokerRelay("/topic","/queue/"); config.setApplicationDestinationPrefixes("/app"); } @Override public void registerStompEndpoints(StompEndpointRegistry

Spring STOMP Websockets: any way to enable permessage-deflate on server side?

99封情书 提交于 2019-12-19 04:14:46
问题 I'm working with spring-websockets under the spring-boot-starter 1.3.1.RELEASE, with the Jetty backend. I am wondering how to enable permessage-deflate in the server. I have a client hosted on a version of Firefox that is willing to negotiate the compression, ie the initial handshake to the WebSocket endpoint includes the compression negotiation header, like: GET https://my-websocket-host/my-endpoint ... Sec-WebSocket-Protocol: v10.stomp,v11.stomp Sec-WebSocket-Extensions: permessage-deflate

Websocket working on localhost but not Heroku

♀尐吖头ヾ 提交于 2019-12-19 03:08:11
问题 I have an application that uses websockets (STOMP over SockJs), with Spring at the backend. Application works fine (websockets) on localhost on Tomcat but when I deploy to Heroku or AWS Web Sockets stop working. My websocket configuration in Angular2 let sockjs = new SockJS('/rest/add?jwt=' + this.authService.getToken(), {"devel":true,"debug":true}, {"transports":["websocket"]}); I also tried with {"disabled_transports":["websocket"]} but both are failing. web.xml <web-app xmlns="http://xmlns

Websocket working on localhost but not Heroku

无人久伴 提交于 2019-12-19 03:07:07
问题 I have an application that uses websockets (STOMP over SockJs), with Spring at the backend. Application works fine (websockets) on localhost on Tomcat but when I deploy to Heroku or AWS Web Sockets stop working. My websocket configuration in Angular2 let sockjs = new SockJS('/rest/add?jwt=' + this.authService.getToken(), {"devel":true,"debug":true}, {"transports":["websocket"]}); I also tried with {"disabled_transports":["websocket"]} but both are failing. web.xml <web-app xmlns="http://xmlns

Sending Error message in Spring websockets

你说的曾经没有我的故事 提交于 2019-12-18 17:26:14
问题 I am trying to send error messages in Spring websockets with STOMP over SockJS. I am basically trying to achieve which is being done here. This is my Exception Handler @MessageExceptionHandler @SendToUser(value = "/queue/error",broadcast = false) public ApplicationError handleException(Exception message) throws ApplicationError { return new ApplicationError("test"); } And I am subscribing to stompClient.subscribe('/user/queue/error', stompErrorCallback, {token: accessToken}); User in my case