const event = client.sendEvent({
  name: "new.user",
  payload: {
    userId: "u_1234567890",
  },
});

You can call this function from anywhere in your backend to send an event. The other way to send an event is by using io.sendEvent() from inside a run() function.

Use eventTrigger() on a Job to listen for events.

For multiple events, use client.sendEvents() instead.

Parameters

event
object
required
options
object

Returns

const event = client.sendEvent({
  name: "new.user",
  payload: {
    userId: "u_1234567890",
  },
});