Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). Varbase Media Header 9.2.1 Minor update available for module varbase_media_header (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

Driplet

No security coverage
View on drupal.org

This module pushes real-time messages to users on your site using the Driplet microservice. It allows for features like live notifications, content updates, system alerts, and even real-time chat by sending messages to specific users, roles, or topics via WebSockets.

A Drupal module that provides pushing messages to the frontend using Driplet microservice. It enables pushing real-time messages to specific users or roles via WebSockets. The module depends on Driplet PHP library.

Use cases

  • Sending real-time notifications to users (example for this can be found inside driplet_notify submodule)
  • Notifying users of new content/updates in real time
  • Alerting about system events or changes
  • View log messages in real time (example for this can be found inside driplet_log submodule)
  • A possibility of creating a real-time chat/chatrooms between users/site visitors
  • Moderation queue alerts
  • Custom live analytics inside Drupal

Requirements

The module works in conjunction with Driplet - a Go-based microservice. Ensure Driplet is properly configured and running before using the module.

How it works

A backend service (e.g. Drupal) can push a message to Driplet microservice, which will then push the message to the frontend clients. The message can be targeted to specific users, roles, or topics. The frontend clients can subscribe to topics and receive messages in real-time.

More on how it works

Driplet can authenticate users based on their JWT tokens which Driplet module generates on (/api/driplet/jwt) endpoint. The JWT includes user ID and user roles which can be used as targeting criteria for messages. For instance, it is possible to send a message only to specific roles, uids, or a combination of both. It's also possible to invert the logic and specify exclusion criteria.

There is also a concept of topics which can be used to group messages. For instance, on a specific page, a frontend user can subscribe only to a topic relevant to that page. This way, the user will receive only messages relevant to that topic. It's possible to subscribe to multiple topics at once, and handle each topic separately.

Submodules

Real-time logs

Enable driplet_log to access real-time logs.

Push notifications

Enable driplet_notify to access real-time push notifications.

How to use

In PHP:

  $driplet = \Drupal::service('driplet.service');

  $message = $driplet->createMessage()
    ->setMessage([
      'some' => 'some',
      'keys' => 'content'
    ])
    ->setTopic('some-topic')
    ->include()
    ->setTarget('roles', 'authenticated');

  $driplet->sendMessage($message);

In JS on the frontend:

const client = DripletClient.getInstance(wsEndpoint, jwtEndpoint);
client.setTopics(['some-topic']);

client.onMessage((data) => {
  if (data.topic !== 'some-topic') return;

  // Handle the message
  console.log('Received message:', data.message);
});

Documentation

Read the supplied Readme.md in the root folder on how to set up the module and how to run Driplet in DDEV.

Activity

Total releases
4
First release
Jan 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 4
Maintenance
Dormant

Release Timeline

Releases

Version Type Release date
1.0.2 Stable Feb 1, 2025
1.0.1 Stable Jan 29, 2025
1.0.x-dev Dev Jan 29, 2025
1.0.0 Stable Jan 29, 2025