Android App Connecting to Node.js server using Socket.io

后端 未结 4 470
一生所求
一生所求 2020-12-07 15:15

I\'m having trouble getting my Android app to connect to a socket.io chat server. I\'m using socket.io-java-client created by Gottox which can be found here: https://github.

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-07 15:28

    I know this not really answers to the OP's posts, but for those who may be interested, this is a tutorial I made to make communicate your Android with a Node.js server -without any additional library- :

    https://causeyourestuck.io/2016/04/27/node-js-android-tcpip/

    This is a foretaste of how it looks like at the end:

    Client socket = new Client("192.168.0.8", 1234);
    socket.setOnEventOccurred(new Client.OnEventOccurred() {
        @Override
        public void onMessage(String message) {
        }
    
        @Override
        public void onConnected(Socket socket) {
            socket.send("Hello World!");
            socket.disconnect();
        }
    
        @Override
        public void onDisconnected(Socket socket, String message) {
        }
    });
    
    socket.connect();
    

提交回复
热议问题