New in 2.4: Test runs you can trust See what's new →

Open a WebSocket that echoes every message back

GETwss://api.testingapis.com/ws/echo

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/echo

Responses

200
OK
101
Switching Protocols: the WebSocket is open.
400
The request was plain HTTP rather than a WebSocket upgrade.

Example

Request
curl -X GET "https://api.testingapis.com/ws/echo"
Response
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!")