Skip to content
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

be a duplex stream #14

Open
mafintosh opened this issue Jul 21, 2015 · 3 comments
Open

be a duplex stream #14

mafintosh opened this issue Jul 21, 2015 · 3 comments
Labels

Comments

@mafintosh
Copy link
Contributor

Hi. Great work on getting the spdy protocol working 🎉

Instead of having the transport.connection.create accept a stream it would be nice if it instead just returned a duplex stream that you could pipe your transport to/from.

var spdy = transport.connection.create()
var socket = net.connect(...)

var req = spdy.request(...)
spdy.on('stream', function (stream) {
  ...
})

socket.pipe(spdy).pipe(socket)

This makes it easier compose stream pipelines with spdy. For example using stdin/stdout

process.stdin.pipe(spdy).pipe(process.stdout)

Or using an encrypted stream

transport.pipe(decryptor).pipe(spdy).pipe(encryptor).pipe(transport)

If this is something you'd be interested in adding I'd be happy to help out with a PR

@indutny
Copy link
Collaborator

indutny commented Jul 21, 2015

I think it might be very interesting, indeed!

Thanks for the proposal!

@jbenet
Copy link

jbenet commented Jul 21, 2015

/seconded, i think this api would be very nice.

@daviddias
Copy link
Member

Hey @mafintosh did you manage to get this working? I'm in the middle of some ipfs-swarm refactoring and this would sweet to make the API simpler. In the process, the multistream-select would get more 'streamy' too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants