Server Sent Events

Platform instances use Server-Sent Events (SSE) for real-time updates on availability requests.

Events are pushed when an availability request is created or updated. Events can be subscribed to by using the sse_jwt. This value can be found in the responses of /availability-requests and /availability-requests/{id}.

"sse_jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzU4NzE2NDMuMzk2MjczLCJtZXJjdXJlIjp7InB1Ymxpc2giOltdLCJzdWJzY3JpYmUiOlsiNjM3NjA2MTE3MmY1ZTdiYmJiMGExZWQyL2F2YWlsYWJpbGl0eV9yZXF1ZXN0Il19fQ.YRA5ebo8ihOZRvWuZ3NGxlV3OE1jShwPB1UONWIgU4o"

After you decode the token it will display the subscription topics that can be used. Below an example of a decoded token.

{
  "exp": 1675871643.396273,
  "mercure": {
    "publish": [],
    "subscribe": [
      "6376061172f5e7bbbb0a1ed2/availability_request"
    ]
  }
}

After subscribing to the topics listed in the subscribe section you will receive messages in JSON format. The structure will match those of multiple or single availability requests.

Last updated

Was this helpful?