Note that there are some explanatory texts on larger screens.

plurals
  1. POSocket.IO not working in Chrome and Firefox on Windows
    primarykey
    data
    text
    <p>I have made a Facebook like chat server and client using node.js (0.10.10), socket.io (0.9.16) and Express (3.2.6). It works perfectly fine in all browsers including all versions of Internet Explorer, but Firefox (21.0) and Chrome (27.0.1453.116) on Windows just won't work. It does work in said browsers on OS X.</p> <p>When I try to debug the errors by viewing the returned data of the error events, the data is always undefined. I have tried all possible transports.</p> <p>This is the simplified code of the chat application I used for testing on Chrome and Firefox in Windows:</p> <p><strong>Client:</strong></p> <pre><code>&lt;script src="http://www.xserverx.com:8080/socket.io/socket.io.js"&gt;&lt;/script&gt; &lt;script&gt; var ioUrl = 'http://www.xserverx.eu:8080'; var socket = io.connect(ioUrl, { 'reconnect': true, 'reconnection delay': 1500, //'sync disconnect on unload': true }); $('#send-button').click(function() { socket.emit('message', { message: $('#message').val() }); }); // Event listeners socket.on('connect', function() { // Display socket transport type // Is empty in Chrome and Firefox on Windows $('#transport-type').html(socket.socket.transport.name); }); socket.on('onlinechange', function(data) { $('#users-online').html(data.online); }); socket.on('message', function(data) { $('#chat').append('&lt;p&gt;' + data.message + '&lt;/p&gt;'); }); socket.on('error', function(data) { $('#errors').html('Error: Error. ' + JSON.stringify(data)); }); socket.on('connect_failed', function(data) { $('#errors').html('Error: Connect failed. ' + JSON.stringify(data)); }); socket.on('reconnect_failed', function(data) { $('#errors').html('Error: Reconnect failed. ' + JSON.stringify(data)); }); &lt;/script&gt; </code></pre> <p><strong>Server:</strong></p> <pre><code>var express = require('express'), app = express(), sio = require('socket.io'); var port = 8080; var io = sio.listen(app.listen(port)); io.set('log level', 1); // Only show warnings and errors io.set('polling duration', 10); io.enable('browser client minification'); io.enable('browser client gzip'); var totalOnline = 0; // Server io.sockets.on('connection', function(socket) { socket.setMaxListeners(0); console.log('---- New user online ----'); totalOnline++; socket.emit('onlinechange', { online: totalOnline }); socket.on('disconnect', function() { console.log('---- User disconnected ----'); totalOnline--; socket.emit('onlinechange', { online: totalOnline }); }); socket.on('message', function(data) { io.sockets.emit('message', { message: data.message }); }); }); console.log('Listening on port ' + port); </code></pre> <p>This is the debug log from the server when connecting a single user with Chrome in Windows:</p> <pre><code>Listening on port 8080 debug - served static content /socket.io.js debug - client authorized info - handshake authorized NnDQmjFbOsc37kSRdPCg debug - setting request GET /socket.io/1/websocket/NnDQmjFbOsc37kSRdPCg debug - set heartbeat interval for client NnDQmjFbOsc37kSRdPCg debug - client authorized for debug - websocket writing 1:: ---- New user online ---- debug - websocket writing 5:::{"name":"onlinechange","args":[{"online":1}]} debug - setting request GET /socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166541799 debug - setting poll timeout debug - discarding transport debug - cleared heartbeat interval for client NnDQmjFbOsc37kSRdPCg debug - clearing poll timeout debug - xhr-polling writing 8:: debug - set close timeout for client NnDQmjFbOsc37kSRdPCg debug - xhr-polling closed due to exceeded duration debug - setting request GET /socket.io/1/jsonp-polling/NnDQmjFbOsc37kSRdPCg?t=1372166551799&amp;i=0 debug - setting poll timeout debug - discarding transport debug - cleared close timeout for client NnDQmjFbOsc37kSRdPCg debug - setting request GET /socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166551918 debug - setting poll timeout debug - discarding transport debug - clearing poll timeout debug - clearing poll timeout debug - xhr-polling writing 8:: debug - set close timeout for client NnDQmjFbOsc37kSRdPCg debug - xhr-polling closed due to exceeded duration debug - setting request GET /socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166562023 debug - setting poll timeout debug - discarding transport debug - cleared close timeout for client NnDQmjFbOsc37kSRdPCg </code></pre> <p>And this is the response from the initial <code>/socket.io/1/?t=1372166652973</code> file:</p> <pre><code>NnDQmjFbOsc37kSRdPCg:60:60:websocket,htmlfile,xhr-polling,jsonp-polling </code></pre> <p>And this is a piece of the Chrome requests log:</p> <pre><code>XHR finished loading: "http://www.xserverx.com:8080/socket.io/1/?t=1372166531543". socket.io.js:2 XHR finished loading: "http://www.xserverx.com:8080/socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166541799". socket.io.js:2 XHR finished loading: "http://www.xserverx.com:8080/socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166551918". socket.io.js:2 XHR finished loading: "http://www.xserverx.com:8080/socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166562023". socket.io.js:2 XHR finished loading: "http://www.xserverx.com:8080/socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166572144". socket.io.js:2 XHR finished loading: "http://www.xserverx.com:8080/socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166582249". socket.io.js:2 XHR finished loading: "http://www.xserverx.com:8080/socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166592351". socket.io.js:2 XHR finished loading: "http://www.xserverx.com:8080/socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166602445". socket.io.js:2 XHR finished loading: "http://www.xserverx.com:8080/socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166612595". socket.io.js:2 XHR finished loading: "http://www.xserverx.com:8080/socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166622697". socket.io.js:2 XHR finished loading: "http://www.xserverx.com:8080/socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166632801". socket.io.js:2 XHR finished loading: "http://www.xserverx.com:8080/socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166642900". socket.io.js:2 XHR finished loading: "http://www.xserverx.com:8080/socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166653115". socket.io.js:2 GET http://www.xserverx.com:8080/socket.io/1/jsonp-polling/NnDQmjFbOsc37kSRdPCg?t=1372166551799&amp;i=0 socket.io.js:2 (FAILED) XHR finished loading: "http://www.xserverx.com:8080/socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166663203". socket.io.js:2 XHR finished loading: "http://www.xserverx.com:8080/socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166673295". socket.io.js:2 XHR finished loading: "http://www.xserverx.com:8080/socket.io/1/xhr-polling/NnDQmjFbOsc37kSRdPCg?t=1372166683405". socket.io.js:2 </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. 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