nowelium / socket.io-titanium

socket.io for titanium mobile
http://youtu.be/10ogNjWCpyc
Other
136 stars 34 forks source link

connection error callback #16

Open farfromrefug opened 12 years ago

farfromrefug commented 12 years ago

To test your framework i use something like this on the iphone simulator

var io = require('socket.io-titanium');
var socket = io.connect('127.0.0.1:8080');
var chat = socket.of('/chat');

while running my server on my mac. It connects and works great. Then i decided to test it on android. Android emulator doesnt seem to work on 127.0.0.1 I can see in the logcat that the connection failed

10-30 11:29:33.996: E/TiHttpClient(877): (TiHttpClient-1) [1001,12561] HTTP Error (org.apache.http.conn.HttpHostConnectException): Connection to http://127.0.0.1:8080 refused

But how do i get that error in my js file? As connect is done immediately on the socket when doing

var socket = io.connect('127.0.0.1:8080');

It s too late to do socket.on() after

I really need to know if the conneciton failed! thank you