Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8743821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:44:44+00:00 2026-06-13T11:44:44+00:00

I’ve been using web-socket-js for websocket support across devices. Works great in all IOS

  • 0

I’ve been using web-socket-js for websocket support across devices. Works great in all IOS devices as they have native web-socket support, and works fairly consistently in android devices when you have flash installed. Now, Android ICS 4.03 and above claims to support native web-sockets. Window.WebSocket is defined, but I’m having no luck opening the socket. Does anyone know why? What is the problem with ICS native websockets? What protocol do they use? Has anyone come up with a better solution?

=Update=

There is a hacky way to determine if the websocket actually works, and then fallback to flash. To do this you have to change the web-socket-js code to check if it is an android client. then, before using the web-socket, try to connect to a port on the local machine. Then check the protocol property of the websocket. If this is defined, then you are good to go with native, otherwise fall back to flash. Still looking for a better way, but here is the hack that I am using now:

eg:

   var isAndroid = navigator.userAgent.match(/Android/i) != null;
   var isChrome = navigator.userAgent.match(/Chrome/i) != null;

   // assume if its safari, that they use normal websockets.
   if ( isChrome || (!isAndroid && window.WebSocket)) {
          logger.log("Will attempt to use Websockets natively. 1");
          return;
   }


   // check if we need a websocket fallback
   //if (window.WebSocket && !window.WEB_SOCKET_FORCE_FLASH) {
   if ( isAndroid ) {
          try {
                 var testSock = new window.WebSocket("ws://localhost:1474");
                 if (testSock.protocol != undefined) {
                       testSock.close();
                       logger.log("Will attempt to use Websockets natively. 2");
                       return;
                 } else {
                       // use flash
                 }
          } catch (e) {
                 // if there was an error we need to use the flash fallback.
          }
   }

   logger.log("Native Websockets unavailable, trying Flash fallback...");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:44:45+00:00Added an answer on June 13, 2026 at 11:44 am

    So, as it turns out, the hack mentioned in my question doesn’t actually always works. Some android devices with 4.0.3 seem to support native web-sockets and others don’t. I’m trying to determine if this difference could be between devices that came with 4.0.3 and those that were upgraded. I now check if flash player is supported first, if it is then I use it. If not, then I check the android version. If it is greater than 4.0 I suggest that the user tries to load the site in chrome. Otherwise, if window.WebSocket is defined I attempt to use it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a text area in my form which accepts all possible characters from
I have thousands of HTML files to process using Groovy/Java and I need to
I am using Paperclip to handle profile photo uploads in my app. They upload
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a small JavaScript validation script that validates inputs based on Regex. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.