Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android browser and socket io

I having trouble getting socket io to send a response on connect for the android browser. I logged the parameters and they are appearing server side, it just seems like that the client side doesn't properly connnect. I disabled jsonp, but I heard that android falls back to xhr anyways.

socket.on('connect',function (data) {
            socket.emit('setNickAndRoom', {nick: nick}, function(response){
//response. nothing :(.
});
});

client.on("setNickAndRoom", function(nick, fn,_){
//etc etc

fn({msg :nick});
});

This works on every browser (even mobile safari, mobile FF, mobile chrome beta). I have to refresh android browser 4-5 times for it to finally connect. BTW, im using streamline js (_)

UPDATE This seems to happen on wifi only

like image 617
re1man Avatar asked Apr 05 '12 19:04

re1man


1 Answers

Limited options at this time:

http://code.google.com/p/weberknecht/

https://github.com/TooTallNate/Java-WebSocket

https://github.com/Gottox/socket.io-java-client

sound right as far as WebSockets go. Socket.IO's specific wire protocol do not appear to have been implemented in Java yet, so you may have to deal with that yourself.

like image 73
JakeWilson801 Avatar answered Sep 30 '22 01:09

JakeWilson801