Socket interrupted in v0.8.6 and Firefox 7.0.1
I'm getting errors creating the web socket in Firefox 7.0.1 - I've tried to make the example as basic as possible. Here we go....
Environment:
OS X Lion (server and client)
Firefox v7.0.1
Node v0.4.11
Socket.io v0.8.6
Console Error:
The connection to ws://home:3000/socket.io/1/websocket/10796925721352367974 was interrupted while the page was loading. http://home:3000/socket.io/socket.io.js Line 2294
NodeJS Output:
node server.js
info - socket.io started
debug - served static content /socket.io.js
debug - client authorized
info - handshake authorized 10796925721352367974
debug - setting request GET /socket.io/1/websocket/10796925721352367974
debug - set heartbeat interval for client 10796925721352367974
debug - client authorized for
debug - websocket writing 1::
debug - websocket writing 5:::{"name":"welcome","args":[{"hello":"Hello."}]}
info - transport end
debug - set close timeout for client 10796925721352367974
debug - cleared close timeout for client 10796925721352367974
debug - cleared heartbeat interval for client 10796925721352367974
debug - discarding transport
server.js
var io = require('socket.io').listen(3000);
io.sockets.on('connection', function (socket) {
socket.emit('welcome', { hello: 'Hello.' });
});
test.html
<!DOCTYPE html>
<head>
<title>Server Test</title>
<script src="http://home:3000/socket.io/socket.io.js"></script>
<script>
var socket = io.connect('http://home:3000');
socket.on('welcome', function(data) {
document.write(data.hello);
});
</script>
</head>
<body>
</body>
</html>
Any help would be appreciated. Thanks!
Are other browsers, such as Chrome 14+, working ok with the same example?
Sorry, yes. I meant to mention that. Chrome works fine.
Ok, that's strange. Are you running any particular addons for FF?
Nothing that should interfere with this, I wouldn't think.... Web Developer, Firebug, Rainbow, and ScreenGrab.
Never heard of Rainbow, but I'll take your word for it. Are you running any particular firewall or antivirus software?
It's an eyedropper/color picker.
Nope, nothing as far as firewall or antivirus.
I did some more poking around. If I comment out the "socket.on('welcome'....)" function in the client code and leave only the "socket = io.connect(...)" line, I don't get the error and Firebug shows the following request:
GET http://home:3000/socket.io/1/?t=1320059543966 200 OK
With the response:
1709344179350188626:15:25:websocket,htmlfile,xhr-polling,jsonp-polling
And the server doesn't hang with the 'discarding transport' error.
Sneaky typo in my previous post .. "take your work for it" would be a horrible thing for me to do.
Anyhoo, there's nothing wrong with your example code, so this really shouldn't happen. I haven't installed Lion on my Mac, but I could always check the latest master with the same code on my snow leopard + ff 7.0.1 when I get home from work.
Thanks. :)
I'll install it on my Ubuntu server later and have a go. At least then maybe we can determine if the problem is Firefox + Lion or Node/socket.io + Lion, since I have the server and client both running on the same machine at the moment.
OK, I get the same thing with the server running on Ubuntu. So using Lion as the server environment isn't the issue.
Wow, and now I feel like the world's largest idiot.
I had restarted Firefox several times and it made no difference - the error would still occur, but after rebooting the computer, the problem has disappeared.
So it sounds like either Firefox or Lion (more likely Firefox, I would imagine) encountered an error somewhere and then didn't clean up properly.
I shall now close this and hide in the corner.
@kellishaver , Though you have closed the issue, I'd like to add that document.write must have caused this. I just hit this issue.
@pdvyas Are you on Lion too? I'm trying to find a pattern here. I'm having that exact issue.
Of course, I will now restart my computer, which means that I'll very likely stop hitting this bug (and that I won't be able to dig this bug further).
I don't use document.write, though.
@pdvyas Do you have any more information on that issue? I am having it right now and a reboot of the computer did not help.
By the way, is this issue Mac-specific?
@espadrine I am on Lion. This fails on Firefox. My issue was that, after receiving the first message, the socket broke and the browser was trying to load something ( which is precisely what the error says, I guess ). As I was testing, I was using document.write , not using it made my testing successful. What is your code ?
@pdvyas Here's the webpage.
I have grep'ed all the JS I use, nowhere is there a single document.write.
@espadrine It seems that there is something broken in your code as even the client side library is not getting loaded. To check with the browser compatibility, etc, try making a trivial app (outside the framework you are working on).
@pdvyas You're right! It is a firefox issue, not a socket.io issue.
I'm on Lion as well with Firefox. The only time I get this message is when I click a link that requires a page refresh but the majority of the links on my site are ajax so its not too noticeable of an error. It always happens when I require a page refresh though.
I have the same problem too!