sockeio Java客户端命名空间连接确认失败

时间:2017-11-18 06:50:43

标签: java node.js socket.io

Socket io服务器具有客户名称空间

let customers = io.of('/customers');

customers.on('connection', function(socket){

    console.log("connected");

    socket.on('disconnect', function (){
             console.log('disconnected from server');
    });

});

io.on('connection', async function (socket) {
    console.log("connected");
  socket.disconnect();

  socket.on('disconnect', function (){
                 console.log('disconnected from server');
        });

  });

如果有人连接到根命名空间,我将断开连接。

我的Android客户端

    Manager manager = new Manager(new URI("http://localhost:3000"));
    Socket  socket = manager.socket("/customers", options);

    socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {

                @Override
                public void call(Object... args) {
                    Log.i("CustomerService", "EVENT_CONNECT");
                }
       }

EVENT_CONNECT回调未触发上述服务器代码。 可能是什么问题?

0 个答案:

没有答案