events
- Sessions API
Session events can be used to send messages related to a specific session for others to receive. This can include status updates or action that running session react on.
For possible events see Session Event Types
Listen for session specific events by registering on the events
endpoint using HTTP long polling.
GET /api/sessions/<token>/events
Parameter | Desciption | Default | Example |
---|---|---|---|
last_event |
The number of the last received event. All events that are newer than last_event are returned immediately. If there are no newer events, connection stays open until a new event is triggered. |
None | last_event=5 |
[
{
"type": "String",
"data": "String",
"number": "Number"
},
...
]
- type: the type of event that occurred.
- data: the actual payload of the event
- number: the number of the event
GET /api/sessions/6fdbd1a0-c339-11e9-b775-6d49dd567772/events?last_event=8
[
{
"type": "status",
"data": "paused",
"number": 9
},
{
"type": "status",
"data": "running",
"number": 10
},
{
"type": "status",
"data": "paused",
"number": 11
},
{
"type": "status",
"data": "running",
"number": 12
}
]
Push session specific events for any registered listeners to receive.
POST /api/sessions/<token>/events
{
"type": "String",
"data": "String"
}
- type: the type of event that occurred.
- data: the actual payload of the event
POST /api/sessions/6fdbd1a0-c339-11e9-b775-6d49dd567772/events
{
"type": "status",
"data": "paused"
}