This documentation site is about the unstable (upcoming) Comentario version.  Switch to the stable version »

Attribute: live-update

The live-update attribute of the <comentario-comments> tag disables live comment updates

The live-update attribute of the comments tag controls whether live updates of comments on the page is enabled.

  • If set to false, the Live update is disabled for this particular page.
  • If set to true or omitted, the Live update is enabled.
This attribute has no effect when live update is disabled globally on the server by passing the --lu.disable option.

Changing the value on-the-fly

This attribute is reactive: changing it on an already-embedded tag subscribes to, or unsubscribes from, live updates without reloading the browser page:

document.querySelector('comentario-comments').setAttribute('live-update', 'false');

Setting it to false closes the websocket connection to the server; setting it back to true, or removing the attribute, opens a new one.

Toggling the attribute also reloads the page data and the comments, in order to pick up whatever has been missed while the subscription was inactive. This discards any comment that is currently being written or edited, so avoid changing the value while the user may be typing.

See also