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

Suggestion: MeteorObservable passing through observables #227

Open
Slavrix opened this issue May 30, 2018 · 0 comments
Open

Suggestion: MeteorObservable passing through observables #227

Slavrix opened this issue May 30, 2018 · 0 comments

Comments

@Slavrix
Copy link

Slavrix commented May 30, 2018

Currently, I've run into an issue where I have an observable on my server side (which is created from Rx.Observable.bindNodeCallback).
When I try to return this observable in a Meteor.Method (not subscribing to it on the server, returning the whole observable) and call it using MeteorObservable.call() on the client I get back an object, that looks like it is an observable( {isScalar:false} etc as you'd expect when logging an observable), however, I cannot subscribe to the observable that is passed through to the client.

///server
Meteor.methods({
            'documents.signDir': function(link) {

               return getDocFromS3(link)
               .pipe(
                 map(res=>  {
                     console.log(res); 
                     return res;
                 })
              )
            }
...

///client

MeteorObservable.call('documents.signDir', 'some/dir/on/s3')
.subscribe((res)=>{
    console.log(res);
    res.subscribe((res2)=>{
        console.log(res2);
    })
})

//output  {isScalar: false}
//error: saying subscribe doesn't exist on res

am I doing something wrong here?
I had a look at what MeteorObservable does and saw that is passes the response from Meteor.call into Observer.next() which seems to be why im getting the response im seeing.

Maybe adding a way to have MeteorObservable pass through a return if it is already an observable?

Feel free to shut me down if I'm just doing something wrong here.

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

1 participant