-
Notifications
You must be signed in to change notification settings - Fork 569
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
#73 Adopt Stream API #147
#73 Adopt Stream API #147
Conversation
This is fine for the moment.
Is this consistent with what Node does?
I think maybe not for the moment.
How so ? |
Node Stream emits either I would have to do a "switch" depending on the reason string or rather rewrite the errors to go through a separate handler. Question is how important is to report these as errors ( Also, as I noted, emitting
nvm |
I think we need to address that. We always need to emit This new behavior also merits new tests separate from the stream tests as well just to retain our sanity. |
Ok, let me add it to this request. |
} else { | ||
this.flush(); | ||
} | ||
this.close(); |
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.
send() or flush() doesn't necessarily really flush writeBuffer to the underlying transport, so data may get lost.
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.
Close does not close the immediately, so no data will be lost.
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.
For websocket, close() immediately invokes the close method of the underlying socket. And at the time, this.writable might be false, causing the send() or flush() buffers the data only in this.writeBuffer, not into the underlying socket.
+1, this would be really useful especially if you want to do things like have a dnode client/server over engine.io |
Sexy- let me know if I can help. |
@mikermcneil I haven't found the time to update this to the new node stream API. If anyone does find the time, this is one of the things that are missing for socket.io 1.0 release. |
We definitely need to prioritize this. |
…catch statement and have it degrade gracefully. Fixes #147
Implements #73
Points to discuss:
server close
,transport close
Also:
emitting 'error' before 'close' makes tests fail
socket.io 'close' clashes with node api
should we support setEncoding method?
other encodings?)
throw an error when user tries to call it
we can't support pause and resume (surely?) - or do we just dummy pause?
Includes Stream API event emitting and fix from socketio/socket.io#476