spring-websocket

Websockets: Is it possible to add multiple Endpoints using SockJS?

▼魔方 西西 提交于 2020-01-16 18:48:51
问题 I want to create 2 web socket endpoints. Can you tell is it possible? What shall be the configuration in that case? 回答1: Your question does not clearly states if you're using plain websockets or STOMP messaging. Plain websocket API If you're using the plain websocket API, the registry API allows you to add as many websocket handlers as you want. @Configuration @EnableWebSocket public class WebSocketConfig implements WebSocketConfigurer { @Override public void registerWebSocketHandlers

Why does STOMP functionality in spring-websocket depend on Spring MVC?

怎甘沉沦 提交于 2020-01-13 19:42:10
问题 Currently, I am trying to use STOMP with websockets using webflux. In order to send a message to a STOMP topic, I need to use SimpMessagingTemplate , which is contributed by spring boot auto configuration when I add @EnableWebSocketMessageBroker But the problem with this is, @EnableWebSocketMessageBroker indirectly expects me to have spring-mvc library in classpath @EnableWebSocketMessageBroker @Import s DelegatingWebSocketMessageBrokerConfiguration which extends

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

瘦欲@ 提交于 2020-01-09 04:14:41
问题 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 the greenhorn on the project and I am currently using Spring websockets to improve efficiency. Instead of the clients constantly pinging the server to see if it has results ready to stream back, the websocket will now just directly contact the

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

[亡魂溺海] 提交于 2020-01-09 04:14:15
问题 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 the greenhorn on the project and I am currently using Spring websockets to improve efficiency. Instead of the clients constantly pinging the server to see if it has results ready to stream back, the websocket will now just directly contact the

Java Spring STOMP: Set broker IP

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-07 05:33:05
问题 I have a Java application using Spring that uses Websocket, which works fine as long as RabbitMQ runs in the same machine as tomcat. How can I set the IP for RabbitMQ ? I am reading the documentation and I don't find it. My current configuration is very similar to the one in the documentation <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:websocket="http://www.springframework.org/schema/websocket" xsi:schemaLocation="

Spring Boot - Angular 5 Websocket

烈酒焚心 提交于 2020-01-06 06:03:17
问题 I am trying to implement Websockets in my SpringBoot - Angular 5 Application. I followed a tutorial. The source code provided in the tutorial works fine on my machine. But the same code is not working when I integrate it with the existing app. Firefox throws the following error. Firefox can’t establish a connection to the server at ws://localhost:5000/socket/658/k5z2si0f/websocket. vendor.8be84d89464cf9b74ba3.bundle.js:1:584796 Firefox can’t establish a connection to the server at http:/

Spring Boot - Angular 5 Websocket

六月ゝ 毕业季﹏ 提交于 2020-01-06 06:03:14
问题 I am trying to implement Websockets in my SpringBoot - Angular 5 Application. I followed a tutorial. The source code provided in the tutorial works fine on my machine. But the same code is not working when I integrate it with the existing app. Firefox throws the following error. Firefox can’t establish a connection to the server at ws://localhost:5000/socket/658/k5z2si0f/websocket. vendor.8be84d89464cf9b74ba3.bundle.js:1:584796 Firefox can’t establish a connection to the server at http:/

Spring Boot Websocket Security with Angular 5

这一生的挚爱 提交于 2020-01-06 05:47:16
问题 I am trying to implement websockets in my SpringBoot + Angular 5 application. I followed this tutorial. The code works fine without spring security. But doesn't work with Spring Security. I posted the same question here. The comment didn't help much. I am still getting these errors on the client Firefox can’t establish a connection to the server at wss://localhost/socket/446/qvjiwvgt/websocket. Firefox can’t establish a connection to the server at https://localhost/socket/446/kwabmpm0

Spring websocket Override DefaultUserDestinationResolver

橙三吉。 提交于 2020-01-04 06:38:29
问题 I want to override DefaultUserDestinationResolver so i can implement my custom queue user destination for example /user/queue/call currently it is changed into /queue/call-user{session-id} , while in my case i want it to be changed into /queue/call-{userid} The reason for this is that i want to be able to send a message to a user that is not subscribed yet and when he subscribe he can receive the message . How can i ask spring to use my implementation of UserDestinationResolver 回答1: Try to

Cannot send user message with Spring Websocket

匆匆过客 提交于 2020-01-04 05:28:07
问题 I read Spring docs about user destinations. I would like to use convertAndSendToUser method to send a message only to a particular user. This is the java code: @Controller public class WebsocketTest { @Autowired public SimpMessageSendingOperations messagingTemplate; @PostConstruct public void init(){ ScheduledExecutorService statusTimerExecutor=Executors.newSingleThreadScheduledExecutor(); statusTimerExecutor.scheduleAtFixedRate(new Runnable() { @Override public void run() { messagingTemplate