引言
T-io网络通讯框架开源之后受到许多同学的喜欢,但是对于使用Spring系列技术的同学用起来稍许不适。于是乎抽时间写了个 starter,很荣幸代码被作者采纳,正式入驻T-io家族包。
tio-websocket-server
tio-websocket-server 是基于tio的websocket协议的实现。并且,无缝对接点对点发送消息,群组消息,客户端连接维护等。所以,基于 tio-websocket-server 的 starter,在使用起来不必关心连接的维护问题,只要做好业务处理即可。在拥有了tio的便利性的同时又可以使用spring的各种特性,极大的简化了spring + websocket 的开发难度。
快速开始
引入 jar 包
org.t-io
tio-websocket-spring-boot-starter
3.3.2.v20190601-RELEASE
添加注解
@SpringBootApplication
@EnableTioWebSocketServer
public class SamplesApplication {
public static void main(String[] args) {
SpringApplication.run(SamplesApplication.class,args);
}
}
修改配置文件
tio:
websocket:
server:
port: 9876
heartbeat-timeout: 60000
#是否支持集群,