Real-Times Updates
Does Falcor support real-times updates? If not is it planned?
Will be opening a roadmap issue on this with more detail in the near future.
Short answer: yes.
I'm sorry but could you elaborate ? Yes supported ? or yes planned ?
Sorry. It's not supported at the moment but we are considering ways in which it could be done.
+1
Any news on real-time updates?
I'd love this feature
That will be great!!
We're using a hybrid method for real-time updates in our app now: Falcor for initial load and pub/sub registration, then a websockets stream for objects as they change.
Sketching something out:
-
A means of decorating a path (similar to
invalidated: true) to indicate it's subscription status/disposition to modify a client's cache: perhapssubscribed: trueorvolatile: true -
A method to call on
falcor-routerto indicate path changes: object added to a range, object with range or key updated, object with range or key deleted.
Curious what thoughts the Falcor team might have...
+1
:+1:
Real time updates are on our radar, but not something we are doing immediately. It may be solved by a related item and rolled into a near term feature. Team Falcor Is going to release the road map shortly.
Until there is an official solution, how can we manipulate the local falcor client cache using an external source for the update events along the lines that @jordanh described?
@rob3c Have your backend return an array of path values and use withoutDataSource to prevent calls to the http data source. E.g. something like this:
websocket.onmessage = res => model.withoutDataSource().set( ...res.data );
@joshdmiller thanks! So the key is to use model.withoutDataSource() to only work with the local JSON Graph, and then make set() and/or invalidate() calls on it for local-only updates.
Any update on official support for this? Also, is the roadmap mentioned above available yet - I couldn't find it. Thanks for all your hard work on this so far.
Hey Nicholas, it's not on the near term roadmap.
I'll get the roadmap out by the end of October
Sorry, I know we've been promising it for a while. We just have someone now (me) who has some cycles to put it together.
Disclaimer: We are not currently using Falcor, but looking into using it as it could replace a lot of home-grown code which does the same things as JSON Graph.
@michaelbpaulson , @sdesai , is there an issue where the specs of this are being discussed?
From glancing at the API, it appears to me that ModelResponse would be where I would expect as an end user, the subscription to be. I think that onComplete would need to be called, when any of the requested paths were removed from the cache.
Just to loop back around on this. There aren't any active design discussions/specs on it currently. It's something we think we'd like to do, but we're actively thinking about near/medium term, so marking it 'longer term' as in, probably more than a year out.
For the record, we have done a fork of falcor-datasource, that is using socket.io: https://github.com/Mixgenius/Falcor-HTTP-WS-DataSource
We are using it in production since more than a year without any issue.
On the client side, the datasource is created using the server URL (model.json), and the websocket URL. There is a management of several connections for the same user using tabIdLabel property. Then there is callback onPushNotifications on the datasource that will be called when new data are receive. It's a JSONGraphResponse with potential invalidated and jsonGraph/paths properties. For each invalidated paths, we do falcorPromise.invalidate(path);, and for for the jsonGraph, falcorPromise.withoutDataSource().set(data).
Hope it could help some others.