WebSocket is an API technology that enables full-duplex communication over a single TCP connection. Compared to traditional HTTP requests, WebSocket has lower latency and higher efficiency. It is suitable for scenarios that require long-term connections and real-time data transmission, such as online games, real-time chats, and more.
- WebSocket API management is only supported by Apidog versions equal to or greater than
Creating a WebSocket API
You can create a WebSocket API in an HTTP project.
- Click the
+button on the left and select
New WebSocket API (Beta).
- Enter the URL of the WebSocket server, starting with
- To disconnect the WebSocket API, click
- We recommend using the Apidog client to use the full features and the best experience of the WebSocket API.
After establishing a WebSocket connection, you can compose messages under the
In addition to directly composing messages in text formats such as
HTML, you can also compose messages in binary formats using
The editor will syntax highlight the message content based on the selected message format. If the message is in
HTML format, you can also format the input content.
Messages below show the connection status, sent messages, and received messages in chronological order.
Click a single message to view the message details on the right:
If the message is in the text format, the formatted message will be displayed by default, and you can manaully switch the messsage format and encoding.
If the message is in binary format, the message's
Hexdumpwill be displayed by default, and you can also view the message encodeed with
Base64and the original message.
Adding Handshake Request Parameters
You can also customize the parameters required to pass during WebSocket handshake, such as
Cookies to meet authentication or other complex scenarios.
The handshake request parameters cannot be modified after the connection is established and must be configured before the connection is established or after the connection is disconnected.
You can use Apidog variables in the WebSocket connection's handshake and messages. For more information on using variables,check on https://apidog.com/help/api-manage/variables/
You can set the
responsible person, and
tags for the WebSocket API, and write a detailed API description in
Of course, you can share the WebSocket API document with teams outside and view it directly in the browser.
After debugging is complete, you can click the
Save button to save the WebSocket API to the directory tree of the
HTTP project, so that other members of the team can debug or view the API documentation.
You can check the FAQ:Websocket if you encounter problems when exporting data.