Field Update

Categories

Component ID

2344913

Component name

Field Update

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

Field Update allows fields to get updated, the moment the field content changes. Updates get send using HTML5 WebSockets, so updates appear immediately. Older browsers, which don't support WebSockets can use an Ajax-Fallbach. Field Update can be enabled per field.

In order to use WebSockets, you have to use WebSocket-Server, that communicate with the clients and your Drupal installation.

This module includes a very basic node.js WebSocket-Server to get started.

Installation

Installation (Basic without WebSockets)

  1. Enable module.
  2. On the settings page of any field instance enable Field Update.
  3. Field Update is working now, but uses the Ajax fallback instead of WebSockets.

Using the WebSocket Server

  1. Create a vendor folder inside the field_update module folder
  2. Download DnodeSyncClient and save it as "DnodeSyncClient.php" inside the vendor folder
  3. Install node.js on your server.
  4. Navigate to the server directory ([field_update-module-folder]/server/nodejs), where you will find a package.json and the server file.
  5. Install the required nodejs modules by executing npm install from the directory.
  6. Start the server: node field_update_server.js. (You may instead consider to let the script run forever...)
  7. Navigate to the field_update Drupal admin configuration page (/admin/config/services/field_update) and enable WebSockets.
  8. After you entered endpoint and ports, Your fields should be updated automatically every time, the field's entity gets saved.

How does it works?

WebSocket is a new feature of HTML5, that basically allows web browsers to not just only send a TCP/IP message to a server (like an Ajax request) but have a full connection with a server (so the server can also send a message to the web browser).

Instead of asking the website every 2 seconds: "Hey server, are there any updates on this field?", the web server can send updates to the client, without them asking before.

This works by starting a WebSocket-Server, thats holds connection to all browsers, that are currently connected to the server. Whenever a Drupal entity gets updated, the Drupal website sends the updated field to the WebSocket server to broadcast it to all clients.