Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web Sockets on Samsung Galaxy S3 Android Browser?

So, apparently the webapp we did, that uses websockets, does not work on the Samsung Galaxy S3 stock Android browser. The thing is, Android Browser is not supposed to have web sockets support, but it looks like this one has, although the websockets don't work, the connection takes forever and never succeeds. Our webapp has a fallback for Android Browser, that uses a flash websockets implementation, in case the user has flash installed, but since it detects websockets are supported on the S3, it does not use the fallback.

Did anybody experienced the same kind of problems ? Does anyone know what version of websockets the S3 browser implements ? (even the WebSocket.org echo test fails)

like image 985
Benjamin Michel Avatar asked Nov 12 '12 18:11

Benjamin Michel


2 Answers

I had the same issue with SGS 3 like you and also we had flash fallback. The problem is that other androids return for us undefined when you call window.WebSocket BUT SGS3 doesn't. So we solved this issue with window.WebSocket = undefined;. So our flash fallback began to work.

like image 117
yazZ Avatar answered Nov 11 '22 22:11

yazZ


It seems like Android's default browser implements the WebSocket API, but it's doing nothing. However (at least on my S2+), there's no CLOSING property in WebSocket, so you could use the following function to detect if WebSockets are actually supported:

websocketSupported = function() {
    if(typeof WebSocket === 'undefined') {
        return false;
    }

    return 'CLOSING' in WebSocket.prototype;
} ();
like image 36
kelunik Avatar answered Nov 12 '22 00:11

kelunik