adobe / aem-core-wcm-components

Standardized components to build websites with AEM.
https://docs.adobe.com/content/help/en/experience-manager-core-components/using/introduction.html
Apache License 2.0
733 stars 741 forks source link

[POC] Implement the page feature “3 people are currently viewing this page” #304

Closed jckautzmann closed 5 years ago

jckautzmann commented 5 years ago

As an author/visitor I'd like to know how many people are viewing the page I'm viewing.

jckautzmann commented 5 years ago

A first implementation/hack has been provided as part of a hacking session at Adobe called Open Friday in commit https://github.com/Adobe-Marketing-Cloud/aem-core-wcm-components/commit/bfd39c809c2214861070c3a4a9319f5096a247e9

The intended logic is based on a client pull mechanism:

Note: the work is far from finalized, there are still a lot of things to tackle (lots of TODOs in the code).

Instead of persisting nodes in the repository, we may want to look at the Sling request listeners: https://sling.apache.org/documentation/the-sling-engine/request-listeners.html

Another option would be to use a server push mechanism (Web push, server push, Web socket)

joerghoh commented 5 years ago

If I understand that correctly, this approach assumes, that you can determine at one point at one AEM instance, how many people are currently looking at this page?

I see some issues which I consider problematic:

I consider this approach highly problematic, I would rather use Analytics data to display this information on a page. This is much more scalable and adresses these issues quite well. And even there I wouldn't render this information server-side, but rather inject via client-side, otherwise you are constantly serving stale information from the caches.

jckautzmann commented 5 years ago

Thx @joerghoh for your feedback. It seems that for now there is not a high demand for such a feature. So we might not pursue this effort with high prio unless the community here or our customers prove us wrong :) Back to the technical side: I agree with you that the mechanism needs to play well with CDN/dispatcher and a farm o publish instances. This information should not be cached with the page HTML. Analytics might be the best solution. I still believe this could also be solved within AEM by having client code:

joerghoh commented 5 years ago

If you have the data in Analytics, it's best if the client (browser) itself pulls this data from Analytics (it's probably doing the request there anyways). Publish instances pulling data from authors might be troublesome (networking/firewall restrictions, but also accounts and passwords etc); so pushing might be better.

gabrielwalt commented 5 years ago

Deferring it for now.