Skip to main content

Demo

See the websocket playground for an example of the AsyncAPI playground.

Add an AsyncAPI specification file

To create pages for your websockets, you must have a valid AsyncAPI schema document in either JSON or YAML format that follows the AsyncAPI specification 3.0+.
Use the AsyncAPI Studio to validate your AsyncAPI schema.
/your-project
  |- docs.json
  |- asyncapi.json

Auto-populate websockets pages

To automatically generate pages for all channels in your AsyncAPI schema, add an asyncapi property to any navigation element. The asyncapi property accepts a path to an AsyncAPI schema document in your documentation repo, a URL to a hosted AsyncAPI document, or an array of links to AsyncAPI schema documents.

Examples with tabs

"navigation": {
  "tabs": [
    {
        "tab": "API Reference",
        "asyncapi": "/path/to/asyncapi.json"
    }
  ]
}

Examples with groups

"navigation": {
  "tabs": [
    {
      "tab": "AsyncAPI",
      "groups": [
        {
          "group": "Websockets",
          "asyncapi": {
            "source": "/path/to/asyncapi.json",
            "directory": "websockets"
          }
        }
      ]
    }
  ]
}
The directory field is optional. If not specified, the files will be placed in the api-reference folder of the docs repo.

Channel page

If you want more control over how you order your channels or if you want to reference only specific channels, create an MDX file with the asyncapi property in the frontmatter.
---
title: "Websocket Channel"
asyncapi: "/path/to/asyncapi.json channelName"
---