Skip to content

Latest commit

 

History

History

starter-websocket

集成 websocket 的四种方案

  • native springboot 原生注解

  • spring springboot spring封装

  • STOMP springboot STOMP

  • tio Tio 收费的,不推荐

后台依赖:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-websocket</artifactId>
</dependency>

前端js:

<!--引用依赖-->
<!--    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>-->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/sockjs.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/index.js"></script>