Spring websocket with sockjs and stomp support on the client side

I am integrating spring web sockets into a web application. And I want to use this for two calls that take up a lot of time in ajax. In my understanding, I see that there are different design options, how can I deal with this. I’m thinking about the following: can you tell me what will be the best option, and if so, why

1) Open the socket connection when the user logs into the application via SockJS and uses this connection to send messages and sign the two calls that I want to make. One of the questions I had with this design is that if the user just closes the browser, will the socket connection remain open?

2) Open the socket connection for each call and close it after receiving the message, but here it takes a lot of resources to establish the connection every time.

I'm new to spring -websocket, SockJS and STOMP, so let me know that my understanding is not right anywhere?

Thank you in advance

+4
source share
1 answer
  • When the user closes the browser, the Web Socket will be disconnected. You can handle this on the server side. I mean, you can notify other users or something else.

  • - . , . . .

, .

:

WebSocket Spring 4

(19 2016 ):

concurrency . , . , . , ThreadPool. , Spring Web Socket.

,

+6

Source: https://habr.com/ru/post/1620181/


All Articles