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

keeping webinterface in sync #983

Closed
jancborchardt opened this issue Dec 20, 2012 · 34 comments
Closed

keeping webinterface in sync #983

jancborchardt opened this issue Dec 20, 2012 · 34 comments

Comments

@jancborchardt
Copy link
Member

jancborchardt commented Dec 20, 2012

Currently the webinterface doesn’t poll for changes, except when reloading, changing apps or folders. This can lead to the displayed data being heavily outdated: for example when you have the web app open, sync some files using the desktop client (or the web app open on another computer) these changes do not appear in the originally open web app.
As this is a problem with not only Files but all apps, it should be a core component.

Thoughts: Websockets, API, post-upload hooks. cc @DeepDiver1975 @karlitschek

@DeepDiver1975
Copy link
Member

@DeepDiver1975
Copy link
Member

Why the angular link above?

We need to move all display related code to the client/javascript - doing this without a javascript framework is just crazy. Some of us already have good experience in this area.

Would be great to see a rapid prototype on this - maybe the files app would be a great show case.

(rapid prototype means we will throw it away! ;-) )

@jancborchardt
Copy link
Member Author

Calling in @Raydiation and @butonic for Angular.

@BernhardPosselt
Copy link
Contributor

I have experience with AngularJS and websockets and I can highly recommend it. If people want to, I could provide an example in the advanced example. Im planning on implementing an model parentclass anyway, which does all the caching for you

PS: The linked example broadcasts the received messages, I ran into problems with this approach. I created a publish/subscriber object where the models registerered themselves for certain messages. The websocket then just publishes the messages over that object.

@DeepDiver1975
Copy link
Member

@Raydiation looking forward to see the demo. As stated above files app would be a good candidate.

@bartv2 please share your thoughts on this. THX

@bartv2
Copy link
Contributor

bartv2 commented Dec 21, 2012

Yes, using websockets looks good.
Maybe use the cache for communicating between different request (webdav->files app). This is already used for the import progress in calendar and contacts

@karlitschek
Copy link
Contributor

Please keep in mind that websockets are not fully supported by all browsers that we have to support. Another challenge with websockets is that connection to the webserver are keept open which is a problem for the scalability of big installations. so please imlement a config switch in config.php to turn it of optionally

@BernhardPosselt
Copy link
Contributor

I'm not sure how big that impact will be, in general it will reduce a lot of bandwidth I think, since we dont have to poll every 30-60 seconds. We could also transition gracefully to a fallback if websockets are not supported by having the fallback implement the same interface.

PS: theres a problem with firefox, when you hit ESC it will close the websocket (known, but low priority bug)

@karlitschek
Copy link
Contributor

Polling is actually something that can be handled well with most server setups. open connections are the problem

@jancborchardt
Copy link
Member Author

If websockets are not supported in a browser – then well, automatic updating simply doesn’t work. That’s ok because currently ownCloud does that in no browser. Plus, this ability should be automatically detected via feature detection and not set by a hard config switch.

Postponing to milestone ownCloud 7.

@MorrisJobke
Copy link
Contributor

Postponing to milestone ownCloud 8

@MorrisJobke MorrisJobke modified the milestones: ownCloud 8, ownCloud 7 Jun 11, 2014
@DeepDiver1975 DeepDiver1975 modified the milestones: ownCloud 8, 8.1-next Jan 8, 2015
@brantje
Copy link
Member

brantje commented Jan 22, 2015

@MorrisJobke Maybe postponing this to OC9? Don't seem to be much progress here.
Websockets are awesome, and OC can use them for sure.
Browser support won't be any problem, http://caniuse.com/#feat=websockets
Only IE9 does not support it, but we can solve that.

Edit: Stupid close and comment button -_-'

@brantje brantje closed this as completed Jan 22, 2015
@brantje brantje reopened this Jan 22, 2015
@PVince81
Copy link
Contributor

PVince81 commented Feb 4, 2015

@brantje AFAIK php doesn't support web sockets. You'd need to setup a separate Node JS server or any other server that supports it, and then make that one poll the ownCloud server for changes or make the server push changes to that server.

And in general requiring users to setup a separate server goes against the "simply setup" philosophy.

@DeepDiver1975
Copy link
Member

another option would be to go for a polling approach similar to the desktop client.
Performing a PROPFIND on the current folder (or root ?) to detect changes based on the etag change.

In order not to DDOS the server the polling should be disabled as soon as the browser window/tab is not active - we have something like this already in place for the free space check - see https://github.com/owncloud/core/blob/master/apps/files/js/files.js#L270

@DeepDiver1975
Copy link
Member

@PVince81 ^ does that make sense?

@PVince81
Copy link
Contributor

PVince81 commented Feb 5, 2015

Yes, makes sense.

For this the list.php endpoint should also return the current folder's fileinfo (including etag).
If we switch to WebDAV at some point that information will be included automatically.

@DeepDiver1975
Copy link
Member

If we switch to WebDAV at some point that information will be included automatically.

sounds like time to switch 😉

There is one remaining issue to be solved: pagination - which is not part of WebDAV.
I was thinking about introducing owncloud specific headers for this purpose like

OC-Page: 5
OC-PageSize: 20

@PVince81
Copy link
Contributor

PVince81 commented Feb 5, 2015

Providing pagination in list.php and/or WebDAV is another topic, let's move it here: #13915

@oparoz
Copy link
Contributor

oparoz commented Jul 11, 2015

The problem with polling is that you get it wrong half the time, so users will still hit refresh after having uploaded files to be sure the view picked it up.The net result is a lot of effort to build something which won't be really useful imho.

I don't think there is a way around introducing a new requirement. I vote for using a php redis extension to push events via eventsource.

@ghost ghost modified the milestones: 9.0-next, 8.2-current Sep 9, 2015
@icewind1991
Copy link
Contributor

Implemented this over the weekend: https://github.com/icewind1991/files_live_reload

Using eventsource in combination with a memcache based buffer

@oparoz
Copy link
Contributor

oparoz commented Sep 21, 2015

Cool :)

@DeepDiver1975
Copy link
Member

Implemented this over the weekend: https://github.com/icewind1991/files_live_reload

Using eventsource in combination with a memcache based buffer

Really nice - but I think this is not the right way to do it, because this introduces yet another code path into the files app and we are trying to move the files app purely on webdav.

We need to implement some light-weight sync algo in js within the files app - once we did move over to webdav ...

@oparoz
Copy link
Contributor

oparoz commented Sep 22, 2015

You can wait a long time before WebDAV does push though:
https://tools.ietf.org/html/draft-pot-webdav-notifications-00

So that means polling, which isn't great.

As a plugin, as designed in files_live_reload, the Files app keeps using the endpoints it currently uses, but knows in real-time when changes are happening.

@DeepDiver1975
Copy link
Member

Push is anyhow not an option for us as multiple times discussed.

Any push approach requires a long living php process which is a nightmare in big installations.

So the only thing we can do is polling .. which is by the way what all mechanisms use (caldav, carddav, our desktop client ......)

@oparoz
Copy link
Contributor

oparoz commented Sep 22, 2015

Push is anyhow not an option for us as multiple times discussed.

Ah, sorry, I missed that discussion. Seems the only way to do push would be to use a daemon available on another port or something similar...

Any push approach requires a long living php process which is a nightmare in big installations.

I was wondering how it would scale. It would require a machine with a lot of RAM...

which is by the way what all mechanisms use (caldav, carddav, our desktop client ......)

What about mobile clients?

@PVince81
Copy link
Contributor

9.0 now uses webdav.

Here is an idea:

  • poll using a PROPFIND with Depth: 0 that requests the etag on the current directory
  • compare etag with old one to see whether there were changes
  • optional: get rid of "getstoragestats.php" that already polls and add the "quota-available-bytes" and "quota-used-bytes" properties to the above PROPFIND (kill two bird with one stone)

That's it for update detection.
Regarding the UI, I'd still vote for simply displaying an orange notification "The contents of the folder has changed, click here to refresh" instead of changing UI elements while the user has their pointer over them.

Moving to 9.1

@PVince81 PVince81 modified the milestones: 9.1-next, 9.0-current Feb 12, 2016
@oparoz
Copy link
Contributor

oparoz commented Feb 12, 2016

Regarding the UI, I'd still vote for simply displaying an orange notification "The contents of the folder has changed, click here to refresh" instead of changing UI elements while the user has their pointer over them.

The problem is that if someone is uploading lots of files, the user in front of the GUI will keep getting that message after every refresh, unless we can get realtime info about the upload and print a "upload in progress" message until we can print "upload completed, you can refresh now".

@PVince81
Copy link
Contributor

You mean uploading outside of the web UI ? If uploading in the web UI, we can disable the refresh message and simply update the directory's known etag.

If they're uploading outside of the web UI, for example with the sync client, then they should get the message only once. Then it's their fault if they click it repeatedly 😉

@oparoz
Copy link
Contributor

oparoz commented Feb 12, 2016

If they're uploading outside of the web UI, for example with the sync client, then they should get the message only once. Then it's their fault if they click it repeatedly 😉

But you'd have to let the user know that new files have been uploaded.

  1. User logs in
  2. Upload starts
  3. Message is shown
  4. User refreshes
  5. Files are still being uploaded, so new files are now hidden until the user hits refresh again
  6. Show message
  7. User refreshes
  8. More files are uploaded, message required
    etc.

@PVince81
Copy link
Contributor

Side note: this is what KDE Dolphin does when new files appear.
This is why I prefer having a simple message "Folder has updated, refresh ?" instead of refreshing instantaneously or periodically and confusing the user:

list-autoscroll

@PVince81
Copy link
Contributor

hint: I'm not scrolling, but a copy is being done from another computer into this folder

@michaelstingl
Copy link

superseded by owncloud/phoenix ?

@brunnomoreira
Copy link

Hi guys, I implemented this file's polling as a simple plugin, which I've tested and seems to work smooth.
Is that strategy according to the idea that you guys were proposing to that?

https://gitlab.com/anolisti/files_polling

@micbar
Copy link
Contributor

micbar commented Sep 16, 2021

Closing, not planned.

@micbar micbar closed this as completed Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests