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

Documentation , dosnt include client side code for connecting to a tcp server #37

Open
doronaviguy opened this issue Sep 16, 2014 · 2 comments

Comments

@doronaviguy
Copy link

When i first i looked at readme , i couldnt find the peace of code for the clients, to connect to the the tcp server ,

var Model = require('scuttlebutt/model');
var net = require('net');

var m = new Model;
var s = m.createStream();

s.pipe(net.connect(8888, 'localhost')).pipe(s);

m.on('update', function cb (key) {
    // wait until we've gotten at least one count value from the network
    if (key !== 'count') return;
    m.removeListener('update', cb);

    setInterval(function () {
        m.set('count', Number(m.get('count')) + 1);
    }, 100);
});

m.on('update', function (key, value) {
    console.log(key + ' = ' + value);
});
@dominictarr
Copy link
Owner

the example in the readme includes the client and the server code.
https://github.com/dominictarr/scuttlebutt#replication

@doronaviguy
Copy link
Author

yep , guess i just missed it .
thoguh i was looking for a server client exmpale,
i guess thats why i didnt notice , the connect example.
Great module, i enjoy.
I was looking for module like that for a while , now .
and i couldnt find it .

Julian Gruber told me about that module .
and thats exactly what i need

On Tue, Sep 16, 2014 at 5:36 PM, Dominic Tarr notifications@github.com
wrote:

the example in the readme includes the client and the server code.
https://github.com/dominictarr/scuttlebutt#replication


Reply to this email directly or view it on GitHub
#37 (comment)
.

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