-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes issue commented on in #377 #501
Conversation
LTGM |
Fixes issue commented on in #377
@@ -775,6 +775,7 @@ Manager.prototype.handleHandshake = function (data, req, res) { | |||
res.writeHead(200, { 'Content-Type': 'application/javascript' }); | |||
res.end('io.j[' + data.query.jsonp + '](new Error("' + message + '"));'); | |||
} else { | |||
res.writeHead(200, { 'Content-Type': 'text/plain' }); | |||
res.writeHead(status); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Two
writeHead
s ? - Why 200 in writeErr? (the other 200 is for jsonp, which we have to do since it has no error handling)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The jsonp response originally had 200, so I kept it for the plaintext
response as well. This isn't as much an http error as a handshake
interpreted by script error, no?
On Aug 31, 2011 5:52 PM, "guille" <
reply@reply.github.com>
wrote:
@@ -775,6 +775,7 @@ Manager.prototype.handleHandshake = function (data,
req, res) {
res.writeHead(200, { 'Content-Type': 'application/javascript' });
res.end('io.j[' + data.query.jsonp + '](new Error%28"' + message +);
} else {
- res.writeHead(200, { 'Content-Type': 'text/plain' });
res.writeHead(status);Two writeHeads ?
Why 200 in writeErr?Reply to this email directly or view it on GitHub:
https://github.com/LearnBoost/socket.io/pull/501/files#r108484
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's why the jsonp one passes an Error object so that we can do a quick instanceof
check to know if the response was successful or not.
For the regular handshake, we of course just inspect the status code. That's why the original has res.writeHead(status), now duplicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the duplicate writehead is bogus. And you're of course right about the
status code. I'll correct both.
On Aug 31, 2011 7:11 PM, "guille" <
reply@reply.github.com>
wrote:
@@ -775,6 +775,7 @@ Manager.prototype.handleHandshake = function (data,
req, res) {
res.w...
That's why the jsonp one passes an Error object so that we can do a quick
instanceof
check to know if the response was successful or not.
For the regular handshake, we of course just inspect the status code. That's
why the original has res.writeHead(status), now duplicated.
Reply to this email directly or view it on GitHub:
https://github.com/LearnBoost/socket.io/pull/501/files#r108609
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks <3
@guille, @einaros, after some tests with socket.io after this update. It turns out that I must have einaros socket.io-client fork to get it work with FF6. Care to check it for me?. Thanks in advance! I tried these : Socket.IO (git cloned) and Einaros Socket.IO-client (git cloned) ---- works |
@pyrostrex, Use FireBug's network tab and verify that FF6 actually tries to use WebSocket as transport with the LearnBoost repo versions, and not actually falls back to FlashSocket. I've made a few updates to my socket.io-client, which allows even WebSocket to fall back to FlashSocket, so this may be what's happening with my builds. |
@einaros, I didn't enable flashsocket. I even use io.set('transports', ['websocket']). I installed firebug and see the network tab just like you did in your comment. and I can't see any "upgrade to websocket" request in firebug. Here's what i did to setup the socket.io:
But when I do the same, but instead of cloned from socket.io-client, I cloned from your repo. Then I refresh my browser. Then the firebug shows the "upgrade to websocket" request and everything else works. |
@einaros, It turns out I forgot to build. Now it's ok. :) |
@pyrostrex, Ah -- well I'm glad you figured it out :) To just straighten this out once and for all, though: you had to build the cloned LearnBoost/socket.io-client before you could get it working? |
@einaros, Yep! on my step. add another step which is "node builder.js". haha. Now trying to find a way to get socket.io websocket to work with latest windows chrome. |
@pyrostrex, What you cloned from the socket.io repo should already have been Regarding WebSockets with the latest Chrome - are you having trouble getting On Thu, Sep 1, 2011 at 3:24 PM, pyrostrex <
|
@einaros, I'm using 13.0.782.218 m of chrome, like I said Windows only. In Mac, it doesn't have this problem. only in Windows. This time, it is much more weirder, it raises the "connection" event on the server but on the client, it still shows "pending" on the network tab. |
@pyrostrex, Ok, 13.0.782.218 uses the old hixie-76 WebSocket standard, so it Did you happen to see if my forks work with that version of Chrome? On Thu, Sep 1, 2011 at 3:41 PM, pyrostrex <
|
@einaros, It still happens with your forks. Here is my output: Server output:
Browser Network Output :
Additional Information :
|
@pyrostrex, Ok - does this work with the WebSocket transport on other On Thu, Sep 1, 2011 at 4:02 PM, pyrostrex <
|
@einaros, I'm using pure nodejs. Wow. It seems to also not working with firefox 6 Windows. For Mac, every browser works (chrome, firefox, safari). For Windows, everything doesn't work. I think it have something to do with the packet parsing thingy? |
@pyrostrex, It's unlikely that it's because of the packet parsing, seeing as See if http://draw.2x.io works from your Windows box. I've got a (fairly On Thu, Sep 1, 2011 at 4:35 PM, pyrostrex <
|
@einaros, I tried your website. It works but this is because of the websocket to flashsocket switching method. My windows is Windows Thin PC and I tried using chrome. |
@pyrostrex, Chrome switched to FlashSocket for your connection to my site? On Thu, Sep 1, 2011 at 4:52 PM, pyrostrex <
|
@einaros, Yeah, maybe because my internet connection is extremely slow? 10kbps? I tried using Firefox 6.0.1, It never stop loading. haha. |
@pyrostrex, Which addons are you using for Chrome and FireFox? And which On Thu, Sep 1, 2011 at 5:01 PM, pyrostrex <
|
@einaros, Lol, I'm using fresh installed windows. Inside a VirtualBox. So no other stuff installed other than browsers. Edit : Chrome and Firefox has firebug installed inside. |
@pyrostrex, Hm, strange indeed. Your internet connection shouldn't be a case If you're able to do a clean WireShark dump of the WebSocket traffic from On Thu, Sep 1, 2011 at 5:05 PM, pyrostrex <
|
@einaros, Never know how to use WireShark. But I will try. |
…syntax error message in the Web Console. Basically an addition to socketio/socket.io#501
See the following issue comment: #377 (comment)
Handshakes weren't correctly passing a content-type header, making some browsers complain about errors parsing xml, although the data is really text/plain.
The pull req also contains two other minor style fixes as a bonus :P