Use sockjs and stomp in java to complete websocket communication

Main configuration import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.messaging.simp.config.ChannelRegistration; import org.springframework.messaging.simp.config.MessageBrokerRegistry; import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; import org.springframework.web.socket.config.annotation.StompEndpointRegistry; import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; import org.springframework.web.socket.config.annotation.WebSocketTransportRegistration; /** * @author * WebSocket configuration class */ @Slf4j @Configuration @AllArgsConstructor @EnableWebSocketMessageBroker public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {<!– –> private final WebSocketInterceptor webSocketInterceptor; private final WebSocketHandshakeInterceptor webSocketHandshakeInterceptor; […]

SockJS in Spring Boot

SockJS in Spring Boot In Spring Boot, SockJS is a compatibility solution for implementing WebSocket. This article will introduce the principle, usage and sample code of SockJS. What is SockJS SockJS is a communication protocol between the browser and the server, which can establish a two-way communication channel based on HTTP between the browser and […]

Solve the Vue dependency error reporting Cannot read property ‘headers’ of null in SockJSServer.js

Foreword When making new requirements and needing to change the project code of Vue, an error suddenly appears TypeError: Cannot read property ‘headers’ of null at Server.socket.on (***/node_modules/webpack-dev-server/lib/servers/SockJSServer.js:68:32) I don’t know why this problem suddenly appeared. It is normal to make changes in this vue project before, so let me talk about my solution Solution […]

[Solved] vue-cli solves IE browser chunk-vendors.js prompts sockjs-client error

IE browser chunk-vendors.js reported sockjs error Click on the error location /***/ “./node_modules/sockjs-client/dist/sockjs.js”: /*!************************************************ ****!*\ !*** ./node_modules/sockjs-client/dist/sockjs.js ***! \************************************************ ***/ /*!no static exports found */ /***/ (function(module, exports, __webpack_require__) { Correct solution Reduce the version of sockjs-client, its dependencies are described in package-lock.json, if this happens, your version may be higher than the version given […]

[Solved] Vue reports error sockjs-node/info?t= or error info?t=

Foreword: Organize the problem log. Problem status: Related information: Introduction to sockjs-node sockjs-node is a JavaScript library that provides a cross-browser JavaScript API that creates a low-latency, full-duplex communication channel between the browser and the web server. Server: sockjs-nodeClient: sockjs-client The reason for the problem: During development, if the network environment is changed (for example, […]