介绍
netty-socketio是socket.io使用Java语言基于Netty网络库编写的WebSocket库.功能非常强大,简单易用,稳定可靠.
com.corundumstudio.socketio
netty-socketio
1.7.14
后端使用Demo
1.配置SocketIOServer
@Value("${my.server.host}")
private String host;
@Value("${my.server.port}")
private Integer port;
@Bean
public SocketIOServer socketIOServer() {
Configuration config = new Configuration();
config.setOrigin(null); // 注意如果开放跨域设置,需要设置为null而不是"*"
config.setPort(this.port);
config.setSocketConfig(new SocketConfig());
config.setWorkerThreads(100);
config.setAuthorizationListener(handshakeData -> true);
final SocketIOServer server = new SocketIOServer(config);
server.start();
return server;
}
@Bean
public SpringAnn