Skip to navigation

Generate WebSocket Reference

View as Markdown

Fern generates WebSocket Reference documentation from an AsyncAPI specification.

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

You can also generate typed WebSocket client libraries in your SDKs.

Configuration

1

Set up your project structure

Add your specification file to your /fern directory.

2

Add the WebSocket Reference to your navigation

Add an api item to your navigation in docs.yml and list your spec under specs with type: asyncapi:

docs.yml
navigation:
- api: API Reference
specs:
- type: asyncapi
path: ./asyncapi.yml

Or reference the spec in generators.yml and add - api: API Reference without specs:

generators.yml
api:
path: asyncapi.yml
origin: https://github.com/your-org/your-repo/blob/main/asyncapi.yml # optional
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
navigation:
- api: Streaming API
api-name: streaming-api
- api: Realtime API
api-name: realtime-api