Live Update
========

Live Update provides a lightweight, generic real-time event and UI updating
layer for Drupal 11+.

It is deliberately decoupling real-time updates from specific features: any
module or custom code can publish events to named channels, and browser code
subscribes to those channels to dynamically update chat messages, views, blocks,
or rendered HTML DOM fragments without full page reloads.

By default, Live Update uses lightweight, intelligent JavaScript HTTP polling
against Drupal, requiring zero external server dependencies. For low-latency
real-time push, it seamlessly upgrades to WebSocket transport when companion
modules like liveupdate_go are enabled.

Requirements
------------

* Drupal 11 or 12.
* Core Block module (dependency).
* JavaScript enabled in the browser.

Quick Start (Zero to Real-Time)
------------------------------

Enable base module and all submodules in a single command:

    vendor/bin/drush en liveupdate liveupdate_views liveupdate_presence liveupdate_remote -y
    vendor/bin/drush lu:status

Suggested 3-Step Sequence:

1. Install and Enable:
   vendor/bin/drush en liveupdate -y && vendor/bin/drush cr

2. Check Status:
   vendor/bin/drush lu:status

3. Test Event Streaming:
   vendor/bin/drush lu:pub entity:node node.updated --payload='{"html":"<p>Test</p>"}'

Drush Commands Reference (lu:*)
------------------------------

* drush lu:status (liveupdate:status)
  Displays system status, polling interval, and debug state.

* drush lu:pub (liveupdate:publish)
  Publishes a real-time event to a target channel.
  Example: drush lu:pub entity:node node.updated --payload='{"nid":1}'

* drush lu:debug (liveupdate:toggle-debug)
  Toggles or sets client console log debugging (--enable=1|0).

Submodule Commands:

* drush lu:v:list (liveupdate-views:list)
  Lists all Views displays with Live Update enabled.

* drush lu:v:refresh (liveupdate-views:refresh)
  Triggers a real-time refresh event for a View display.

* drush lu:r:status (liveupdate-remote:status)
  Lists configured remote API table blocks, channels, and TTL.

* drush lu:r:refresh (liveupdate-remote:refresh)
  Triggers a refresh event for a remote table block.

* drush lu:p:status (liveupdate-presence:status)
  Displays active authenticated users and anonymous visitor counts.

* drush lu:p:purge (liveupdate-presence:purge)
  Purges expired presence sessions from database (--ttl=60).

Configuration & Administration
------------------------------

Configure Live Update at /admin/config/services/liveupdate.

* Polling Interval: Controls how often browsers ask Drupal for events.
* Block Live Updates: Go to /admin/structure/block, configure a block, and check
  "Update this block live".
* Remote Data Tables: Enable liveupdate_remote and configure API sources.
* User Presence: Enable liveupdate_presence and place presence blocks.

Documentation
-------------

For full Markdown documentation, developer API examples, and security details,
see README.md in the module directory.
