# example-websocket
**Repository Path**: dh215/example-websocket
## Basic Information
- **Project Name**: example-websocket
- **Description**: 三种websocket连接方式(开箱即用)
1、使用socket.io架构 (底层使用netty封装)
2、使用原生的netty创建对应的websocket服务端
3、使用springboot集成的【spring-boot-starter-websocket】
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 4
- **Forks**: 3
- **Created**: 2024-03-20
- **Last Updated**: 2025-04-24
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# example-websocket (websocket 例子)
# 三种websocket连接方式(开箱即用)
| 模块 | 使用架构 | 优劣 |
|---------------------------------------------------------------|------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| [example-websocket-io](example-websocket-io) | 使用socket.io架构 (底层使用netty封装) | **客户端:**
1、特别友好,都封装好了对应的代码
**服务端:**
1、需要使用开源的工具类使用
2、集成gateway需要重新编写
3、并且注册将服务端手动注册到nacos上 |
| [example-websocket-netty](example-websocket-netty)- | 使用原生的netty创建对应的websocket服务端 | **客户端:**
1、需手动编写对应的web socket连接
**服务端:**
1、需要一定的基础学习,扩展性强
2、集成gateway需要重新编写
3、并且注册将服务端手动注册到nacos上 |
| [example-websocket-springboot](example-websocket-springboot)- | 使用springboot集成的【spring-boot-starter-websocket】 | **客户端:**
1、需手动编写对应的web socket连接
**服务端:**
1、开箱即用
2、集成gateway便捷 |
# 项目如何使用
1、 项目启动;
2、点击项目下【[resources](example-websocket-io%2Fsrc%2Fmain%2Fresources)】html 文本 (打开即可通信)
3、注意点:服务端有心跳机制,超过30秒未收到客户端的响应,会主动的断开服务