Skip to main content

Event API (2.0)

EventService

The event API provides a mechanism for you to subscribe and publish events between your backend services and the composition, as well as receive events from the live and layout api.

Publish Event

Request Body schema: application/json
name
required
string [ 1 .. 128 ] characters

Name of the event.

payload
required
object

Value of the event. This can be a free-form value which we do not inspect.

requestMetadata
object

Metadata associated with the publishing of the event. Typically this is information about why the event happened. Use payload for what the event is.

object (v2EventTarget)

Targetting for an event Event targetting allows you to listen or publish an event against a specific target. You can assume that: When subscribing, you will receive events for the chosen scope and any higher scope that isn't targetted. This means

  • An event published against a layoutId can be listened to by targetting the given layoutId, projectId or collectionId
  • An event published against a collectionId can be subscribed by scoping to any given projectId or layoutId under the collection.

Responses

Request samples

Content type
application/json
{
  • "name": "my_app:user_chat",
  • "payload": {
    },
  • "requestMetadata": {
    },
  • "target": {
    }
}

Response samples

Content type
application/json
{
  • "name": "my_app:user_chat",
  • "payload": {
    },
  • "target": {
    },
  • "requestMetadata": {
    },
  • "id": "7f23f76c-1990-4a50-b3b9-d615703c777f"
}

Stream Events

query Parameters
correlationId
string

Optional value to tag any return values with. This can be any string-based value that your are able to track.

subscribe.name
required
string

Event name to subscribe to for custom events. This can be a wildcard my_service:* or multiple events my_event|my_other_event.

subscribe.target.collectionId
string

Subscribe to events in a given collection.

subscribe.target.projectId
string

Subscribe to events in a given project.

subscribe.target.layoutId
string <uuid>

Stream events to a specific layout. Note: when specified, collection_id and project_id are implictly defined. If you choose to define them, you they must match the layout.

unsubscribe.name
required
string

Event name to subscribe to for custom events. This can be a wildcard my_service:* or multiple events my_event|my_other_event.

unsubscribe.target.collectionId
string

Subscribe to events in a given collection.

unsubscribe.target.projectId
string

Subscribe to events in a given project.

unsubscribe.target.layoutId
string <uuid>

Stream events to a specific layout. Note: when specified, collection_id and project_id are implictly defined. If you choose to define them, you they must match the layout.

publish.name
required
string

Name of the event.

publish.target.collectionId
string

Subscribe to events in a given collection.

publish.target.projectId
string

Subscribe to events in a given project.

publish.target.layoutId
string <uuid>

Stream events to a specific layout. Note: when specified, collection_id and project_id are implictly defined. If you choose to define them, you they must match the layout.

ping
string

Initiate a ping-pong message.

Responses

Response samples

Content type
application/json
{
  • "result": {
    },
  • "error": {
    }
}