Entradas

Mostrando las entradas etiquetadas como server push

Spring Boot (2) Websockets. Subscriptions of only one member

Imagen
 1. Introduction WebSockets are useful for informing a user of the progress of a heavy process. There are a lot of blogs and videos about this question.  Spring boot uses the STOMP protocol 2. Creating the project Use Spring boot initializer  for creating the project, use these dependencies: Spring boot dev tools Lombok Spring Web Thymeleaf Websocket And use gradle format Then import it from Eclipse as File > Import > Gradle > Existing Gradle Project The final project structure after adding all the needed classes, html and js file is: 3. Add the needed dependencies to the build.gradle file Add javascript dependencies to the build.gradle implementation ' org.webjars:webjars-locator-core ' implementation ' org.webjars:sockjs-client:1.5.1 ' implementation ' org.webjars:stomp-websocket:2.3.4 ' implementation ' org.webjars:bootstrap:3.3.7 ' implementation ' org.webjars:jquery:3.6.4 ' Add also the Gson dependencies, and the build.xml file ...