Message processing

PubNub has three products for processing and acting on your app's real-time data: Functions, Moderation, and Illuminate. Each one runs at a different point in the message flow. In the documentation menu, they sit under Logic, in the Serverless, Moderation, and Real-time decisions sections.

Product (menu section)What it doesBest forHow to use it
Functions (Serverless)Serverless JavaScript that runs at the edge on message eventsTransforming, routing, filtering, enriching, or aggregating messages in codeWrite and deploy from the Admin Portal. No changes needed in your client SDK.
ModerationRules and tools to manage message contentFlagging, blocking, or reviewing messages on live channelsSet up in the Admin Portal. No code required.
Illuminate (Real-time decisions)Metric-based rules that trigger automated actionsActing on aggregated patterns across your traffic over timeConfigure in the Admin Portal. No integration work needed.

Functions​

Functions are serverless JavaScript that runs on PubNub's global network. They attach to specific events in your app's message flow and execute code when those events occur. Write the code. PubNub deploys and runs it.

Functions support nine trigger types, grouped by when they run:

  • Before delivery (synchronous). Run on the original message before it reaches subscribers. The message waits for the Function to complete, so this type can add latency. Use it to transform, validate, block, or enrich a message in flight. Covers Before Publish, Before Publish File, and Before Signal.
  • After delivery (asynchronous). Run on a copy of the message after delivery. They do not delay the message and cannot change what subscribers received. Use them for logging, forwarding to external systems, or aggregation. Covers After Publish, After Publish File, After Signal, and After Presence.
  • Scheduled and on-demand. On Interval runs on a configurable schedule for periodic cache refreshes, batch operations, or aggregating metrics from message history. On Request exposes a public REST endpoint for webhooks and inter-Function calls.

Functions include built-in access to a key-value store, cryptographic utilities, and outbound HTTP calls to external APIs.

For details on trigger types, the key-value store, and how to create and deploy Functions, see Functions.

Moderation​

Moderation gives you tools to manage the content of messages on your channels. PubNub supports two approaches:

  • Manual moderation uses Channel Monitor in BizOps Workspace in the Admin Portal. You watch live conversations on selected channels and act from the UI: edit or delete messages, mute users, or ban them from a channel.
  • Automatic moderation uses configurable rules in BizOps Workspace to flag or block messages automatically based on content patterns, without requiring manual review for every message.

For details on Channel Monitor and configuring auto-moderation rules, see Moderation.

Illuminate​

Illuminate is a real-time decision engine. You define what data to capture from published messages, create metrics that aggregate that data, write rules that evaluate the metrics, and configure automated actions that trigger when a rule fires.

Unlike Functions, which execute on individual message events, Illuminate works on aggregated patterns across your traffic over time. Once configured, Decisions run without manual intervention.

Illuminate has three modules: Business Objects capture data and compute metrics, Decisions evaluate metrics and trigger actions, and Dashboards visualize outcomes and trends.

For details on Business Objects, Decisions, and Dashboards, see Illuminate in Real-time decisions.

Was this page useful?

Last updated on