Server-sent events for refresh part of page

Added by David Doležal over 1 year ago

Hi,
I tried quite long time to developed solution how automatically refresh issue's notes without refreshing whole page.

I tested soulution via AJAX or JS with refreshing only DIV "history" using timer. For example:

$(document).ready(function(){
setInterval(function(){
      $( "#history" ).load(window.location.href + " #history.");
      /*$( "#tab-content-history").load(window.location.href + " #tab-content-history.tab-content");*/
}, 30000);
});

It doesn't work how I expacted. Page is refreshed, but notes don't show.

I tested for example plugin redmine_refresh, which use gem deface and automatically refresh issue list and my page after 120s...

But I think it exists better way how it solved. I'm aiming on Server-Sent Event. For example: gem ld-evensource

How I imagine it can works - focused on issue-detail page:
On server running "services" who listen changes on issues (create issue, update issue, ...).

If issue is new, then work as normal (like now).
If issue is updated, then check attributes which was changed and journal has no notes, then reload div #history, show tab History and Changes
If issue is updated, then check attributes which was changed and journal has note, then reload div #history, show tabs History, Notes and Changes and show note.

Maybe I forgot some stuff.

Unfortunatly I'm not ruby/redmine developer so I have problem to solve it myself.

I would like to create discussion about this problem, so come to talk about it. I appreciate it. :-) Redmine is great, but this feature will send him on Olymp... :-)

Feel free for question.

With best regards
David

EDIT: here is link on issue https://www.redmine.org/issues/35229. There is complete describe how I'm thinking about this problem.

Replies (3)

RE: Server-sent events for refresh part of page - Added by Lorenzo Meneghetti about 1 year ago

Hi, adding SSE support could be a long time task. It's a good idea but needs feedback and discussions from community. Try to search for a plugin for client AJAX solution based on timers to fetch journal updates.
thanks

RE: Server-sent events for refresh part of page - Added by David Doležal about 1 year ago

Hi Lorenzo,
thank you for you reply. I think it's quite important feature for next releases of Redmine. Of course I know, it's not easy to solve it, but it's not impossible. I'm not (not yet) Ruby or Redmine developer. Maybe this education video will be for somebody more familier then for me.

Faye websockets part 1
https://www.youtube.com/watch?v=IOav0Uju_DQ&list=PLoQwKu-bfLSZ6kkTy48Vdt6IJqYUaPjKr&index=276

Faye websockets part 2
https://www.youtube.com/watch?v=4zY_ADCphcA&list=PLoQwKu-bfLSZ6kkTy48Vdt6IJqYUaPjKr&index=273

RE: Server-sent events for refresh part of page - Added by David Doležal about 1 year ago

Somebody to good point or idea how to solve it? :-)

(1-3/3)