-
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 to event encoding and acknowledgement #242
Conversation
The last three is of concern. Don't know so far how to remove commits... |
@@ -414,7 +414,7 @@ Manager.prototype.handleHandshake = function (data, req, res) { | |||
function writeErr (status, message) { | |||
if (data.query.jsonp) { | |||
res.writeHead(200); | |||
res.end('io.j[' + data.query.jsonp + '](new Error(' + message + '));'); | |||
res.end('io.j[' + data.query.jsonp + '](new Error(' + JSON.stringify(message) + '));'); |
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.
i'll rather see "' + message + '"
here instead of a JSON.stringify.
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.
what if message is verbatim 'I like to collaborate to "3rd-Eden"'? ;)
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.
message.replace(/\"/g, '\\"')
;D? I rather prevent as much JSON.stringify's as possible as they are blocking actions.. There is no streaming JSON parser / stringifier yet ;9..
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.
Here we stringify a short message once for a faulty connection. It's not used in normal message traffic. But I admit that, if we are sure we won't use dquotes in our error messages, your initial proposal saves a couple of ticks.
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.
I'm going with 3rd-Eden's first approach here.
Please, consider applying the last three commits -- they are critical. TIA |
@@ -329,7 +329,7 @@ Manager.prototype.handleClient = function (data, req) { | |||
if (count == 1) { | |||
// initialize the socket for all namespaces | |||
for (var i in self.namespaces) { | |||
self.namespaces[i].socket(data.id, true); | |||
self.namespaces[i].handlePacket(data.id, {type: 'connect'}); |
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 way this works changed recently. Please see up-to-date version.
No description provided.