spring-websocket

Spring Boot, Websockets cannot obtain user (i.e, java.security.Principal) from Session

若如初见. 提交于 2019-12-09 18:33:59
问题 Working with Spring Boot 1.2.1.RELEASE and Spring Websockets . Having a deployment runtime issue where when running embedded Jetty 9 , I cannot fake a user ( java.security.Principal ) successfully when app deployed anywhere else but localhost. I have consulted http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html#websocket-stomp-authentication http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html#websocket-server-runtime

Simple: convertAndSendToUser Where do I get a username?

五迷三道 提交于 2019-12-09 07:30:44
问题 In Spring Boot (Websockets) I just saw this example: messaging.convertAndSendToUser( username, "/queue/notifications", new Notification("You just got mentioned!")); Where does the guy get a username from? I can't find any mention about where to get that username... 回答1: This answer is written based on this application: https://github.com/spring-guides/gs-messaging-stomp-websocket In order to register a user, you must first create an object that will represent it, for example: public final

Stomp spring web socket message exceeds size limit

为君一笑 提交于 2019-12-08 23:53:41
问题 I am implementing spring web-socket into our spring mvc web application. However I am running into message over size limits when I am trying to send a really big message to an endpoint. I am getting the following error, message:The 'content-length' header 68718 exceeds the configured message buffer size limit 65536 14:49:11,506 ERROR [org.springframework.web.socket.messaging.StompSubProtocolHandler] (http-localhost/127.0.0.1:8080-4) Failed to parse TextMessage payload=[13684590},..],

Java SockJS Spring client and message size

一个人想着一个人 提交于 2019-12-08 23:11:31
问题 Using SockJS java client, I am trying to connect to Spring sockjs server and is getting error 1009 for messages (without headers) of ~20Kb. Javascript library works fine. Transport closed with CloseStatus[code=1009, reason=The decoded text message was too big for the output buffer and the endpoint does not support partial messages] in WebSocketClientSockJsSession [id='9fa30eb453e14a8c8612e1064640646a, url=ws://127.0.0.1:8083/user] I have couple of config classes on server (I do not know at

websocket sessions sample doesn't cluster.. spring-session-1.2.2

你。 提交于 2019-12-08 11:40:37
问题 I'm testing clustering of spring sessions websocket sample. I'm running the sample as described in docs: http://docs.spring.io/spring-session/docs/current/reference/html5/guides/websocket.html. Code from: https://github.com/spring-projects/spring-session/archive/1.2.2.RELEASE.zip. If I run the app on one Tomcat server, all works as expected. but If I run two apps on two servers all does not work. I start the app on each of two Tomcat servers at 8080 and 8090 and login to each. 8080 comes up

Spring Session Basic Auth token passed as query parameter in Spring-Websocket

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 10:32:32
问题 Currently we have Rest app with Spring Boot, Spring Session (Redis) and Spring Security. We use basic auth. Now I would like to add websocket support. When client logs in successfully to other part of application, he gets x-auth-token. It is passed later as header, and it works. Then websocket client sends this token as query parameter to connect to service. We would like to make Spring Security and Spring Session accept token through query param in websocket connection. Is there any

How to access request object in @MessageMapping method with spring websocket implementation

百般思念 提交于 2019-12-08 07:21:23
问题 I am integrating an existing spring MVC web application with spring websockets. I was successfully able to integrate by following the instructions in https://spring.io/guides/gs/messaging-stomp-websocket/ The existing web application has a filter, which sets a few of the attributes. I have a requirement to access the attributes set by the filter in the controller i,e in @MessageMapping method. Could some one tel how can we access the request object in the @MessageMapping method? 回答1: When a

Websockets / STOMP with ActiveMQ Artemis on Wildfly 10 not working

随声附和 提交于 2019-12-08 06:28:15
问题 I am implementing a WebSockets application using Spring WebSockets. As a STOMP broker, I want to use Wildfly's Artemis (Active MQ). I did the following configuration in standalone-full.xml: Adding the following acceptor: <acceptor name="stomp-acceptor" factory-class="org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory"> <param name="protocols" value="STOMP" /> <param name="port" value="61613" /> </acceptor> add a new application user guest/guest to application-users

Why not one method to connect and send in websocket?

时光总嘲笑我的痴心妄想 提交于 2019-12-08 03:30:53
问题 I am new websocket and refering to the below Spring Websocket tutorial and it is working fine in my system. I am also using stomp.js and sockjs-0.3.4.js. https://spring.io/guides/gs/messaging-stomp-websocket/ If the html and javascript has two distinct methods like below, it works. function connect() { var socket = new SockJS('/app/hello'); stompClient = Stomp.over(socket); stompClient.connect({}, function(frame) { setConnected(true); console.log('Connected: ' + frame); stompClient.subscribe(

How configure the Spring Sockjs Java Client message converters

只谈情不闲聊 提交于 2019-12-07 23:06:53
问题 I have one SockJS Java client that use STOMP. Is base on this https://github.com/rstoyanchev/spring-websocket-portfolio/blob/master/src/test/java/org/springframework/samples/portfolio/web/load/StompWebSocketLoadTestClient.java. My code: package mx.intercommunication.websocket.stompclient; import org.springframework.messaging.converter.StringMessageConverter; import org.springframework.messaging.simp.stomp.StompCommand; import org.springframework.messaging.simp.stomp.StompHeaders; import org