Android-Entwicklung, Gottox socket.io-java-client: Datei nicht Font Ausnahme /socket.io/1/

hier ist mein problem:

Ich habe versucht zu verwendensocket.io-java-client für eine Android-App, aber ich bin am Ende mit einem Handshake-Fehler (siehe unten).

Hier ist mein App-Quellcode:

public void runIO(){
    try {
        SocketIO socket = new SocketIO("http://192.168.1.60:1337");
        socket.connect(new IOCallback() {
            @Override
            public void onMessage(JSONObject json, IOAcknowledge ack) {
                try {
                    System.out.println("Server said:" + json.toString(2));
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }

            @Override
            public void onMessage(String data, IOAcknowledge ack) {
                System.out.println("Server said: " + data);
            }

            @Override
            public void onError(SocketIOException socketIOException) {
                System.out.println("an Error occured");
                socketIOException.printStackTrace();
            }

            @Override
            public void onDisconnect() {
                System.out.println("Connection terminated.");
            }

            @Override
            public void onConnect() {
                System.out.println("Connection established");
            }

            @Override
            public void on(String event, IOAcknowledge ack, Object... args) {
                System.out.println("Server triggered event '" + event + "'");
            }
        });

        // This line is cached until the connection is establisched.
        socket.send("Hello Server!");
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

und meine Node.js / Socket.io:

    var app = require('http').createServer(handler)
    var io = require('socket.io')(app); 
    var fs = require('fs');

    app.listen(1337);

    function handler (req, res) {
      fs.readFile(__dirname + '/index.html',
      function (err, data) {
        if (err) {
          res.writeHead(500);
          return res.end('Error loading index.html');
        }

        res.writeHead(200);
        res.end(data);
      });
    }

    io.on('connection', function (socket) {
      socket.emit('news', { hello: 'world' });
      socket.on('my other event', function (data) {
        console.log(data);
      });
    });

Und ich erhalte den folgenden Fehler:

    06-09 03:59:53.955: W/System.err(11738): io.socket.SocketIOException: Error while handshaking
    06-09 03:59:53.965: W/System.err(11738):    at io.socket.IOConnection.handshake(IOConnection.java:322)
    06-09 03:59:53.965: W/System.err(11738):    at io.socket.IOConnection.access$7(IOConnection.java:292)
    06-09 03:59:53.970: W/System.err(11738):    at io.socket.IOConnection$ConnectThread.run(IOConnection.java:199)
    06-09 03:59:53.970: W/System.err(11738): Caused by: java.io.FileNotFoundException: http://192.168.1.60:1337/socket.io/1/
    06-09 03:59:53.975: W/System.err(11738):    at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:186)
    06-09 03:59:53.975: W/System.err(11738):    at io.socket.IOConnection.handshake(IOConnection.java:313)

In einem Browser funktioniert es und die Seite unterhttp://192.168.1.60:1337/socket.io/1/ gibt die folgende Nachricht zurück (über einen Browser):

{"code":0,"message":"Transport unknown"}

Ich weiß nicht, was ich tun soll, damit es funktioniert. Bitte helfen Sie: x

Danke: D

BEARBEITEN:

WieLarky sagte, ich musste meine Version von Socket.io auf downgraden0.9.16. Es funktionierte wie ein Zauber mit dem folgenden Knotencode:

    var io = require('socket.io').listen(80); 

    io.on('connection', function (socket) {
      socket.emit('news', { hello: 'world' });
      socket.on('my other event', function (data) {
        console.log(data);
      });
    });

Antworten auf die Frage(1)

Ihre Antwort auf die Frage