navidrome/plugins/capabilities/websocket_callback.yaml

136 lines
5.7 KiB
YAML

version: v1-draft
exports:
nd_websocket_on_text_message:
description: OnTextMessage is called when a text message is received on a WebSocket connection.
input:
$ref: '#/components/schemas/OnTextMessageInput'
contentType: application/json
output:
$ref: '#/components/schemas/OnTextMessageOutput'
contentType: application/json
nd_websocket_on_binary_message:
description: OnBinaryMessage is called when a binary message is received on a WebSocket connection.
input:
$ref: '#/components/schemas/OnBinaryMessageInput'
contentType: application/json
output:
$ref: '#/components/schemas/OnBinaryMessageOutput'
contentType: application/json
nd_websocket_on_error:
description: OnError is called when an error occurs on a WebSocket connection.
input:
$ref: '#/components/schemas/OnErrorInput'
contentType: application/json
output:
$ref: '#/components/schemas/OnErrorOutput'
contentType: application/json
nd_websocket_on_close:
description: OnClose is called when a WebSocket connection is closed.
input:
$ref: '#/components/schemas/OnCloseInput'
contentType: application/json
output:
$ref: '#/components/schemas/OnCloseOutput'
contentType: application/json
components:
schemas:
OnBinaryMessageInput:
description: OnBinaryMessageInput is the input provided when a binary message is received.
type: object
properties:
connectionId:
type: string
description: ConnectionID is the unique identifier for the WebSocket connection that received the message.
data:
type: string
description: Data is the binary data received from the WebSocket, encoded as base64.
required:
- connectionId
- data
OnBinaryMessageOutput:
description: OnBinaryMessageOutput is the output from the binary message handler.
type: object
properties:
error:
type: string
description: |-
Error is the error message if the callback failed.
Empty or null indicates success.
nullable: true
OnCloseInput:
description: OnCloseInput is the input provided when a WebSocket connection is closed.
type: object
properties:
connectionId:
type: string
description: ConnectionID is the unique identifier for the WebSocket connection that was closed.
code:
type: integer
format: int32
description: |-
Code is the WebSocket close status code (e.g., 1000 for normal closure,
1001 for going away, 1006 for abnormal closure).
reason:
type: string
description: Reason is the human-readable reason for the connection closure, if provided.
required:
- connectionId
- code
- reason
OnCloseOutput:
description: OnCloseOutput is the output from the close handler.
type: object
properties:
error:
type: string
description: |-
Error is the error message if the callback failed.
Empty or null indicates success.
nullable: true
OnErrorInput:
description: OnErrorInput is the input provided when an error occurs on a WebSocket connection.
type: object
properties:
connectionId:
type: string
description: ConnectionID is the unique identifier for the WebSocket connection where the error occurred.
error:
type: string
description: Error is the error message describing what went wrong.
required:
- connectionId
- error
OnErrorOutput:
description: OnErrorOutput is the output from the error handler.
type: object
properties:
error:
type: string
description: |-
Error is the error message if the callback failed.
Empty or null indicates success.
nullable: true
OnTextMessageInput:
description: OnTextMessageInput is the input provided when a text message is received.
type: object
properties:
connectionId:
type: string
description: ConnectionID is the unique identifier for the WebSocket connection that received the message.
message:
type: string
description: Message is the text message content received from the WebSocket.
required:
- connectionId
- message
OnTextMessageOutput:
description: OnTextMessageOutput is the output from the text message handler.
type: object
properties:
error:
type: string
description: |-
Error is the error message if the callback failed.
Empty or null indicates success.
nullable: true