Open a WebSocket that echoes every message back
On connect the server sends a JSON welcome message. Text and binary messages are echoed unchanged; sending the text close makes the server close with 1000 "Bye!". Messages over 64KB are rejected with close code 1009.
Swagger UI cannot open WebSockets. Use a WebSocket client instead:``wscat -c wss://api.testingapis.com/ws/echoSwagger UI cannot open WebSockets. Use a WebSocket client instead:``wscat -c wss://api.testingapis.com…
Responses
- 200
- OK
- 101
- Switching Protocols: the WebSocket is open.
- 400
- The request was plain HTTP rather than a WebSocket upgrade.
Example
curl -X GET "https://api.testingapis.com/ws/echo" \
-H "X-TestingApis-Key: YOUR_API_KEY"WebSocket. Connect with ws://{host}/ws/echo. Every text or binary message is echoed back; send "close" to make the server close the socket.
> hello
< hello
> close
< (server closes: 1000 "Bye!")Sign in to see the details
The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.