Skip to content

retrieve method documentation and behavior is confusing #13

@benzmuircroft

Description

@benzmuircroft

What I am trying to do is have two tabs (tabs A and B) open both users create there own mesh doc. Then they can write to their own doc as much as they want when ever they want in only one row named after their id.

I am then trying to then synchronize the docs together so user A gets user B's row (the one only he can write to) in a stream so that when ever user B fires a change event on that row A will write in the change to his doc in a row named after user B's id.

So they should both have matching auto updating docs at the end.

the retrieve method just looks like it is retrieving/looking in its' self!? I have been trying to make sense of this by console logging in side the index file of rtc-mesh and I see that an rtc-dcstream with read and write capabilities is created but only after the retrieve callback has fired. If I assign variables to the callback(err,result) and log/dir what comes through I get a Row object presumably from my own tabs model. I don't see why a stream is created after one of my own rows was returned to me? And the docs say that if it does not exist then it with be created (why??). I also can't access the stream as its just doing whatever its doing in the background (I imagine just staying open and doing nothing). The docs don't say how to use rtc-mesh in a practical way. for example, this is for web rtc so wouldn't it make sense to write your examples from the point of view of having tab A and tab B open? The examples you have are like if I wanted to create two model docs and then just look at them on my own tab when the rtc-mesh module says that it provides a way of sharing data between clients using scuttlebutt. And that's another part that is really confusing.. your module installs scuttlebutt but your example / docs use crdt then the stream that isn't returned in the callback only records data when scuttlebutt is used and if inside function joinMesh(id, dc) { I put this:

writer.on('data', function(a,b,c) {
  console.log('captured ??? data: ', a,b,c);
});

It picks nothing up if crdt is used but if scuttelbutt is used i see the logs on both tabs. But it's not returned to me via retrieve's callback.

I don't get what is returned? And I am even more confused by the stream... tied up and locked in the cuboard O.o

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions