falcor icon indicating copy to clipboard operation
falcor copied to clipboard

Real-Times Updates

Open fdecampredon opened this issue 10 years ago • 20 comments

Does Falcor support real-times updates? If not is it planned?

fdecampredon avatar Aug 17 '15 21:08 fdecampredon

Will be opening a roadmap issue on this with more detail in the near future.

jhusain avatar Aug 18 '15 06:08 jhusain

Short answer: yes.

jhusain avatar Aug 18 '15 13:08 jhusain

I'm sorry but could you elaborate ? Yes supported ? or yes planned ?

fdecampredon avatar Aug 18 '15 14:08 fdecampredon

Sorry. It's not supported at the moment but we are considering ways in which it could be done.

jhusain avatar Aug 18 '15 17:08 jhusain

+1

HighOnDrive avatar Aug 19 '15 05:08 HighOnDrive

Any news on real-time updates?

a9a4k avatar Nov 20 '15 08:11 a9a4k

I'd love this feature

sheerun avatar Feb 05 '16 13:02 sheerun

That will be great!!

carlosvillu avatar Feb 05 '16 13:02 carlosvillu

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:

  1. A means of decorating a path (similar to invalidated: true) to indicate it's subscription status/disposition to modify a client's cache: perhaps subscribed: true or volatile: true

  2. A method to call on falcor-router to 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...

jordanh avatar Feb 05 '16 14:02 jordanh

+1

zanettin avatar Feb 20 '16 15:02 zanettin

:+1:

tchap avatar Mar 08 '16 10:03 tchap

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.

ThePrimeagen avatar Mar 08 '16 19:03 ThePrimeagen

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 avatar Jun 09 '16 16:06 rob3c

@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 avatar Jun 09 '16 17:06 joshdmiller

@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.

rob3c avatar Jun 09 '16 18:06 rob3c

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.

nicholasleblanc avatar Oct 06 '16 14:10 nicholasleblanc

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.

sdesai avatar Oct 07 '16 16:10 sdesai

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.

bryanerayner avatar Oct 20 '16 16:10 bryanerayner

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.

sdesai avatar Oct 04 '17 22:10 sdesai

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.

ludovicthomas avatar Oct 05 '17 09:10 ludovicthomas