AndroidAsync Socket.IO receive callback value

▼魔方 西西 提交于 2019-12-25 04:22:18

问题


I'm trying to build an application for Android using this library: https://github.com/koush/AndroidAsync and I was trying to receive a callback value from the server like this but the app crashes:

  client.emit("callbackTry", new Acknowledge() {
        @Override
        public void acknowledge(JSONArray arg0) {
            Log.e(TAG,"acknowledge: "+ arg0);
        }
  });

I leave you the server-side:

socket.on('callbackTry', function (callback) {
    console.log(callback);
    var hello = "Hello";
    callback(hello);
});

How can I return the data back to the client?


回答1:


I found a solution myself which consists on changing emit method to emitEvent. Hope it really help someone else too.



来源:https://stackoverflow.com/questions/24137412/androidasync-socket-io-receive-callback-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!