APIs ‐ Websocket Config - altoiddealer/ad_discordbot GitHub Wiki

Client Websocket Config

Key values that can be used in the websocket Client parameter.

Parameter Value Type Description Default
url string Full WebSocket URL; fallback to HTTP-based connection if omitted None
client_id_required bool Whether a client ID must be appended to the connection URL False
client_id_format string Format for generated client ID: uuid, short, timestamp, hex, etc. uuid
token_required bool Whether a token is required in the URL False
token_name string The query param key used to pass the token (e.g., "token", "auth") token
auth_token string Token value if token_required is True None
session_id_required bool Whether a session ID is required for reconnect/resume False
session_id_name string The query param key used for the session ID session_id
session_id string Session ID value if required None
channel_required bool Whether a channel/room must be specified False
channel_name string The query param key used for the channel channel
channel string The channel value if required None
version_required bool Whether a version must be passed False
version_name string The query param key used for the version version
version string Version value if required None
headers dict Optional headers sent during the WebSocket connection {}
query_params dict Key-value pairs turned into query string (?key=val...) {}
reconnect_on_failure bool Whether to auto-reconnect on connection failure True
retry int Number of retry attempts if reconnecting 1

Dynamic Query Parameter Placeholders

Dynamic placeholders can be used anywhere within the WebSocket configuration, including inside query_params, url, headers, and even within payload values. These placeholders follow the format {placeholder_name} and are automatically resolved to their actual values at runtime when:

  • The client is initialized via the script

  • The client is toggled on via /toggle_api

This allows for flexible and dynamic configuration without hardcoding runtime values.

Example usage:

headers:
  Authorization: "Bearer {token}"
query_params:
  client_id: "{client_id}"
  token: "{token}"
  version: "{version}"
  session_id: "{session_id}"
  channel: "{channel}"
  app_name: "MyApp"
  debug: "1"

Supported Dynamic Placeholders:

Placeholder Description Source
{client_id} Auto-generated or user-supplied client ID Based on client_id_format or user set
{token} Authorization token if token_required is true Provided via config or runtime override
{session_id} Session identifier for reconnect/resume logic Set via config or dynamically generated
{channel} Channel or topic name Optional; tied to channel_required
{version} API version value Used when version_required is true