java - Connection problems with the socket.io-client to socket.io server 0.9.6 -
i have problem socket.io code android.
the server uses socket.io 0.9.6 on android i'm using socket-io-client-0.1.3.jar , engine-io-client.0.2.3.jar nkzawa
after connection mychannel
myconnect
emitted. afterwards "something_changed" message if changes new values. version in js works fine, on android get:
event_connect_error: com.github.nkzawa.engineio.client.engineioexception: xhr poll error
any ideas how prepare it?
socket = io.socket(websocket + "mychannel"); socket.on(socket.event_connect, new emitter.listener() { @override public void call(object... args) { socket.emit("myconnect", userinfo); } }).on(socket.event_connect_error, new emitter.listener() { @override public void call(object... arg0) { log.e("event_connect_error", arg0[0].tostring()); } }).on("something_changed", new emitter.listener() { @override public void call(object... args) { jsonobject obj = (jsonobject) args[0]; log.i("something_changed", obj.tostring()); } }); socket.connect();
i faced same issue. causing because of net access permission.
add net permission in manifest.
<uses-permission android:name="android.permission.internet" ></uses-permission>
it should work.
java android websocket socket.io
No comments:
Post a Comment