我正在使用以下项目来构建
socket.io
服务器:
https://github.com/mrniko/netty-socketio
public class ServerTest {
public static void main(String... args) {
Configuration config = new Configuration();
config.setPort(8080);
config.setAuthorizationListener(new AuthorizationListener() {
public boolean isAuthorized(HandshakeData handshakeData) {
System.out.println("yes!" + handshakeData.getAddress());
return true;
}
});
final SocketIOServer server = new SocketIOServer(config);
server.addEventListener("message", String.class, new DataListener<String>() {
public void onData(SocketIOClient socketIOClient, String s, AckRequest ackRequest) throws Exception {
System.out.println("hey");
}
});
server.start();
}
}
我接受所有连接,我已经用socket.io javascript客户端测试了如下连接:
var ws = io.connect('localhost:8080');
ws.on('connect', function() {
ws.emit('message', "I am a message!");
});
ws.emit('message', {data: "I am a message!"});
我怎样才能破译这条信息?有没有办法调试发送到服务器的对象类型?