Skip to content

Instantly share code, notes, and snippets.

@picsoung
Created February 4, 2026 10:36
Show Gist options
  • Select an option

  • Save picsoung/53fd79a75c43743ca5686236d4599a1f to your computer and use it in GitHub Desktop.

Select an option

Save picsoung/53fd79a75c43743ca5686236d4599a1f to your computer and use it in GitHub Desktop.
asyncapi: 3.1.0
info:
title: Test websocket schema
version: 1.0.0
description: This is a test websocket API.
channels:
channelOne:
title: Test channel
description: >-
This is a websocket channel.
It can have _markdown_ in the description.
* Use the "echo-websocket.hoppscotch.io" server to receive timestamped messages every second.
* Use the "echo.websocket.org" server to send test messages to the websocket. This server will echo back any messages you send to it.
address: /
messages:
TestMessage:
$ref: '#/components/messages/TestMessage'
Timestamp:
$ref: '#/components/messages/Timestamp'
servers:
echo-websocket:
host: echo-websocket.hoppscotch.io
protocol: wss
echo:
host: echo.websocket.org
protocol: wss
operations:
sendTestMessage:
action: receive
channel:
$ref: '#/channels/channelOne'
messages:
- $ref: '#/channels/channelOne/messages/TestMessage'
receiveTestMessage:
action: send
channel:
$ref: '#/channels/channelOne'
messages:
- $ref: '#/channels/channelOne/messages/TestMessage'
receiveTimestamp:
action: send
channel:
$ref: '#/channels/channelOne'
messages:
- $ref: '#/channels/channelOne/messages/Timestamp'
components:
messages:
TestMessage:
title: Test message
description: Test message sent to the echo server
payload:
type: object
properties:
text:
type: string
description: The text of your message
subtext:
type: string
description: Optional second message field
from:
type: string
description: The name of the sender
required:
- text
Timestamp:
title: Timestamp
description: Timestamp message sent from echo hoppscotch server
payload:
schema:
$ref: '#/components/schemas/Timestamp'
schemas:
Timestamp:
type: string
description: Timestamp message sent from echo hoppscotch server
examples:
- '22:02:27 GMT+0000 (Coordinated Universal Time)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment