Generate WebSocket Reference

View as Markdown

Fern generates WebSocket Reference documentation from an AsyncAPI specification or Fern Definition.

WebSocket API Reference Example
Example of how a WebSocket API Reference renders in Fern

Configuration

1

Set up your project structure

For AsyncAPI: Add your specification file to your /fern directory and create a generators.yml that references it:

generators.yml
1api:
2 path: asyncapi.yml
3 origin: https://github.com/your-org/your-repo/blob/main/asyncapi.yml # optional

For Fern Definition: Add your WebSocket definition files to a definition/ directory (Fern auto-detects this).

2

Add the WebSocket Reference to your navigation

Add - api: API Reference to your navigation in docs.yml:

docs.yml
1navigation:
2 - api: API Reference
3

Customize the layout

For a full list of configuration options and layout customizations, see Customize API Reference layout.

Include more than one WebSocket Reference

To include multiple WebSocket definitions in your documentation, use the api-name property. The api-name corresponds to the folder name containing your WebSocket definition.

fern
fern.config.json
docs.yml
streaming-api
asyncapi.yml# Streaming WebSocket AsyncAPI spec
generators.yml
realtime-api
asyncapi.yml# Realtime WebSocket AsyncAPI spec
generators.yml
docs.yml
1navigation:
2 - api: Streaming API
3 api-name: streaming-api
4 - api: Realtime API
5 api-name: realtime-api