关于 springboot 中使用 websocket 的疑问?
資深大佬 : woyao396 5
现在网上资料大多有 2 种使用方式:
- 使用
@ServerEndpoint("/hello")然后用如下注解放在方法是
-
@OnOpen
-
@OnMessage
-
@OnError
-
@OnClose
2.使用 spring 官方文档基于STOMP 的方案
https://spring.io/guides/gs/messaging-stomp-websocket/
想问一下这 2 者的区别,依赖情况,以及那种是最优方案?
现在需要解决的业务问题是:后端实时向前端推送执行 shell 脚本的日志
大佬有話說 (3)