Demo地址:
git clone https://github.com/GodwinGodwin/websocket.git
依赖坐标:
前端js代码 ws.onopen ws.onmessage&ws.onclose 配置ServerEndpointExporter websocket服务 Websocket类里的方法 sendMessage方法 向前端发送消息<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
网友评论