Open cobbweb opened 9 years ago
Hello there,
Certainly, at least, if I understood your use case correctly :smiley: .
Data is sent to you after you subscribe to some publication. A call to myAsteroidInstance.subscribe
returns a subscription object, which has a ready
property, a promise which will be fulfilled once the subscription is "ready". That is, after the initial data set has been sent to you.
I guess what you want to do is "chain" on that promise.
Example:
myAsteroidInstance.subscribe("myPublication").ready.then(function () {
// The initial data set is now available
});
I've never tried using Asteroid for server-side rendering, so I have no clue of how it might work, but I'm very interested! How do you plan to set it up? One instance per client (which authenticates for that client) or one "big", persistent, privileged instance?
Let me know! Cheers
I was playing with the Subscription.ready
promise, but it never seemed to resolve and my app would hang if I relied on it. I started a test script here just so it's isolated from the rest of my stack/code: https://github.com/cobbweb/isomorphic-react-example/blob/spike/asteroid/test.js
That script is just hanging at the moment, and 'ready'
is never printed :/ Meteor backend is up and running fine though, and my frontend works great.
any update on this? I'm also having this problem. then()
never gets called.
I'm trying to do server-side rendering (in node.js), using Asteroid as the data layer.
Is there anyway to do an async data fetch and run a callback when there's data available?
Late Edit: I've already tried the
ready
promise on subscriptions, but it never seems to get executed. I can't even get a simple script to log results and exit.