Overview
PulseGrid supports two common publishing styles:
- WebSocket send: a connected client sends a realtime event over its live socket.
- Server publish: a trusted backend publishes over HTTP into the same channel.
Use event=message for normal text. Use predictable dot-separated names such as order.created, delivery.updated or support.ticket.assigned for structured business events.
Setup
Use WebSocket sending when the sender already has a live connection.
Use HTTP publishing for backend workflows, scheduled jobs, bots, integrations and services that do not need to stay connected.
Keep business data inside data. Use meta for supporting context such as source, trace IDs or UI origin.
Code example
await pg.channel("operations").publishEvent("delivery.updated", {
identifierId: "dispatch_api",
identifierLabel: "Dispatch API",
data: { order_id: "ORD-1042", status: "in_transit" },
meta: { source: "node_backend" },
});
connection.sendEvent("driver.location.updated", {
data: { driver_id: "D-88", lat: -25.7479, lng: 28.2293 },
});
pg.channel("operations").publish_event(
"delivery.updated",
identifier_id="python_worker",
identifier_label="Python Worker",
data={"order_id": "ORD-1042", "status": "delivered"},
meta={"source": "python_backend"},
)
connection.send_event(
"driver.location.updated",
data={"driver_id": "D-88", "lat": -25.7479, "lng": 28.2293},
)
Notes
Do not put a whole event envelope inside normal message text. PulseGrid already supplies event IDs, channel/project information, sender, source and timestamp.
Persisted history depends on the channel's persist_events setting and retention policy.