> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.paradex.trade/ws/general-information/introduction/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.paradex.trade/_mcp/server. # WebSocket API The Paradex WebSocket API provides real-time market data and account updates. WebSockets allow for a persistent connection between the client and server, enabling efficient two-way communication. > **SBE required for public channels as of 21 September 2026** > > As of 21 September 2026, Paradex requires Simple Binary Encoding (SBE) for public channel payloads. See [Binary Encoding (SBE)](/ws/general-information/binary-encoding-sbe) for details on how to enable it. ## Server URLs | Environment | WebSocket URL | | ----------------- | -------------------------------------- | | Testnet (Sepolia) | wss\://ws.api.testnet.paradex.trade/v1 | | Mainnet | wss\://ws.api.prod.paradex.trade/v1 | ## Public vs Private Channels The Paradex WebSocket API provides two types of channels: * **Public Channels**: Publish information about the exchange that is not specific to a particular account. Examples include market summary, order book, trades, etc. You do not need to authenticate to subscribe to public channels. * **Private Channels**: Publish information about a particular account. You need to authenticate to subscribe to private channels. ## Establishing a Connection To establish a WebSocket connection, you can use various programming languages and libraries. When running Python-based code, Python 3.10+ is recommended. ### Example in Python ```python import asyncio from paradex_py.api.ws_client import ParadexWebsocketClient from paradex_py.environment import TESTNET async def main(): # sbe_enabled selects binary encoding for public channel payloads. ws_client = ParadexWebsocketClient(env=TESTNET, sbe_enabled=True) await ws_client.connect() print("Connected") asyncio.run(main()) ``` Upon successful connection, you should see: ``` Connected ``` ## Maintaining a Connection Paradex has implemented ping/pong functionality as part of the WebSocket specification. This works at the protocol level: * The server sends a ping message every 55 seconds * The client must respond with a pong within 5 seconds * Upon receiving the pong, the connection is renewed for 60 seconds * If the server doesn't receive a pong within the 5-second window, the connection is terminated Most modern WebSocket libraries and frameworks automatically handle ping/pong messages. If you're using older libraries or building a WebSocket client from scratch, you may need to implement this functionality manually. To display incoming ping messages, you can use the following wscat command: ```bash wscat -P -w 120 -c wss://ws.api.testnet.paradex.trade/v1 -x '{"id":1,"jsonrpc":"2.0","method":"subscribe","params":{"channel":"markets_summary"}}' | grep "ping" ``` ## Next Steps * Learn how to [authenticate your WebSocket connection](/ws/general-information/authentication) * Explore [available channels and subscription methods](/ws/general-information/subscription-channels) * Understand [error handling](/ws/general-information/error-handling) for WebSocket connections