django-notify-x icon indicating copy to clipboard operation
django-notify-x copied to clipboard

Notification concatenation support

Open v1k45 opened this issue 8 years ago • 4 comments

I am trying to implement notification concatenation support for the app. Notification concatenation will give ability to add multiple actors to the notification instead of creating separate notification. It will render the notification like John, Joe and 24 others followed you instead of rendering all 26 notifications with the same target and recipient separately.

This implementation will simply update the time stamp of the notification and add actors to it. This creates a problem because the notification update view uses notification id as the flag to fetch new notification which are greater than that of the notification id sent by the flag parameter (read more @ docs). It will not update the primary key of the notification, so fetching new notification will be quite a mess here.

So, I thought of changing the update mechanism from ajax polling to websockets. The problem is, there are many ways to do it but the popular way is either to use Node.JS or to follow a python approach where a change in WSGI settings is required.

My question is What will be the best way to do add websocket support to the app?

v1k45 avatar Dec 20 '15 15:12 v1k45

@v1k45 if we change the update view to receive a timestamp instead of notification id?

With a timestamp the server can send back all the updates since then, and the javascript part can do the local updates based on the IDs that are new, and the ones that are already on the DOM, but need to be updated.

On the regards of doing websockets, there's a plan to bring channels to Django 1.10, backported to 1.8 and 1.9. But it may take a while. This project was chosen to be founded by Mozzila to receive US$ 150k. So I think that will be the best way to do websockets on Django.

fgmacedo avatar Dec 20 '15 16:12 fgmacedo

Yeah, updating things with respect to the last modified timestamp is indeed a good idea. I think we should follow the ajax polling approach until channels is added into django.

Also, this approach will drop support for anonymous text field for actors and target. I just wanted to know if the anonymous fields are important for a anyone other than me. If not, we can simply remove them before anyone uses the app in production.

v1k45 avatar Dec 20 '15 16:12 v1k45

Notification concatenation features are added in nf_concat_support branch. Currently, it only supports ~~Django 1.8.X on~~ Python3.

I'll try to extend support as soon as possible :)

v1k45 avatar Dec 30 '15 20:12 v1k45

Any progress?

galeo avatar Apr 10 '18 04:04 galeo