spring boot框架下使用websocket实现前后端消息

2018-10-23  本文已影响0人  Scientist_ab99

写了一个小的demo来实现springboot框架下的websocket,通过聊天室的形式展现,可以客户端互相发送消息,服务器端也可以接受推送消息。

首先,需要加依赖

下面贴上demo的代码

websocketconfig类

websocketserver类

websocketcontroller类

index.html

server.html

结构目录

上一篇 下一篇

猜你喜欢

热点阅读