![](https://csdnimg.cn/release/download_crawler_static/86354152/bg1.jpg)
基于 netty-socketio 进行全平台消息推送
官网地址:
https://socket.io/
https://github.com/socketio/socket.io
https://github.com/mrniko/netty-socketio
https://github.com/mrniko/netty-socketio-demo
基本使用
1、 服务器依赖文件
<!-- 服务端 -->
<dependency>
<groupId>com.corundumstudio.socketio</groupId>
<artifactId>netty-socketio</artifactId>
<version>1.7.7</version>
</dependency>
<!-- 客户端 -->
<dependency>
<groupId>io.socket</groupId>
<artifactId>socket.io-client</artifactId>
<version>1.0.0</version>
</dependency>
2、 服务端程序
package com.gwzx.gwzxyw.socket.test;
import org.apache.log4j.Logger;
import com.corundumstudio.socketio.AuthorizationListener;
import com.corundumstudio.socketio.Configuration;
import com.corundumstudio.socketio.HandshakeData;
import com.corundumstudio.socketio.SocketIOClient;
import com.corundumstudio.socketio.SocketIOServer;
import com.corundumstudio.socketio.listener.ConnectListener;
import com.corundumstudio.socketio.listener.DisconnectListener;
import com.gwzx.gwzxyw.socket.SocketManager;
public class ServerDemo {
private static Logger logger = Logger.getLogger(ServerDemo.class);