Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Websocket API is not supported by default in all the browsers at the moment (as per my knowledge) it should work on chromium though try testing it on chromium or firefox(after editing the default settings)and see if that still reverts to XHRPolling.</p> <blockquote> <p>I am running it on a different IP as I need to run node on port 80 which causes conflict on my web server with Apache. Can websockets/flashsockets not be use cross-domain?</p> </blockquote> <p>Now there might be 2 different reasons for the bug from here</p> <ol> <li><p>Web/Flash Sockets will not let u connect to the node.js client unless either u specify a differnt port like 81 or u specially specify apache to proxy the incoming request to Node. an easy solution could be writing the Node.js based HTTP server to just relay data from Apache (and setting Apache to run on a differnt port then 80) </p> <p><a href="http://www.groovypost.com/forum/linux/change-apache-port-from-80-to-8080-t92215.html">This link</a> tells how to do that... in this process you can make Node.js do something like check if the request is from a websocket/httpbrowser if thats an http browser forward the request to Apache if not ie if thats from web/flash sockets then handle the socket accordingly. or as commented on the question. Specify APACHE to proxy to Node.js.</p></li> <li><p>Flashsockets require you to serve a crossdomain policy file on port 843 are you sure you are providing a cross domain file? (I think socket.io has inbuilt functionality to do that but still its always good to check.)</p></li> </ol> <p>As told on the socket.io main website</p> <p>In order to provide realtime connectivity on every browser, Socket.IO selects the most capable transport at runtime, without it affecting the API.</p> <ul> <li>WebSocket</li> <li>Adobe® Flash® Socket</li> <li>AJAX long polling</li> <li>AJAX multipart streaming</li> <li>Forever Iframe</li> <li>JSONP Polling</li> </ul> <p>It's pretty clear that it will revert to AJAX Long Polling if websockets are disabled and Adobe Flash Socket fails to connect (this might be due to the unavailability of the policy file). </p> <p>Here's a sample code for the cross domain file which you can include in your code and see if that makes your server run with websockets. </p> <pre><code>var net = require("net"); // Node.js var Policy = net.createServer(function(socket) { socket.setEncoding('utf8'); socket.on('connect',function(){ console.log("Policy Request"); socket.end("&lt;?xml version=\"1.0\"?&gt;&lt;!DOCTYPE cross-domain-policy SYSTEM \"/xml/dtds/cross-domain-policy.dtd\"&gt;&lt;cross-domain-policy&gt;&lt;allow-access-from domain=\"*\" to-ports=\"*\" secure=\"false\"/&gt;&lt;/cross-domain-policy&gt;"); }); }); Policy.listen(843); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload