-
Notifications
You must be signed in to change notification settings - Fork 9
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
Automatic object stream piping #26
Comments
Hey @mcollina can you elaborate with some (pseudo) code? |
So you might want to use a https://www.npmjs.org/package/from2 fro generating some events to pop to a client. Right now you have to do: session.on('channel', function(chan) {
chan.on('data', function(msg) {
var chan = chan.WriteChannel()
from2(...).pipe(chan)
msg.returnChannel.end({
more: chan,
error: false
})
})
}) Using graft syntax: through.obj(function(msg, enc, done) {
var chan = msg._channel.WriteChannel()
from2(...).pipe(chan)
msg.returnChannel.end({
more: chan,
error: false
})
}) However, with this you might want to use: through.obj(function(msg, enc, done) {
msg.returnChannel.end({
more: from2(...),
error: false
})
}) and it gets automatically piped. This would also greatly help seneca integration, as at that point it could just forget about channels. The only point will be Transform streams, which must get an |
could we abstract the pain by doing the channel switching under the hood in response to a |
deja vu? #22 |
@AdrianRossouw this is the missing bit for #22. However it requires some changes to msgpack5. @davidmarkclements for sure! This requires some changes to msgpack5, if you want to help we can discuss the details there. |
Currently, we cannot pass a standard objectMode stream inside a channel with automated piping: we need to create a new channel and pipe.
Is it sound to use that pattern? Plus, solving this issue might be more tricky, because Transform stream are not supported by the automated piping natively, you will need to flag them with something like
jschanReadable
orjschanWritable
.Any opinions on this?
The text was updated successfully, but these errors were encountered: