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

What is the remote_stream in the example code? #22

Open
pietgeursen opened this issue Dec 29, 2018 · 1 comment
Open

What is the remote_stream in the example code? #22

pietgeursen opened this issue Dec 29, 2018 · 1 comment

Comments

@pietgeursen
Copy link

//create a stream and pipe it to another instance
var stream = ebt.createStream('bob')
stream.pipe(remote_stream).pipe(stream)

I'm trying to understand where that remote_stream variable comes from. And more importantly what it's for.

@dominictarr
Copy link
Contributor

remote_stream is a connection to the remote peer speaking ebt protocol. it's another instance of ebt.createStream, but at the other end of the network connection.
for example, in the tests: https://github.com/dominictarr/epidemic-broadcast-trees/blob/master/test/stream.js#L45-L51

var a_stream = alice_ebt.createStream('bob') //alice's stream for bob
var b_stream = bob_ebt.createStream('alice') //bob's stream for alice
a_stream.pipe(b_stream).pipe(a_stream)

I use the term "remote" in this way through out muxrpc documentation.

In practice, in ssb, it's via a muxrpc duplex stream, but you could go over tcp stream (if you ONLY did ebt) and in the tests it does it directly without using networking, to make the tests more deterministic.

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

No branches or pull requests

2 participants