Send a ping. You can use ping messages to verify that the remote endpoint is responsive.
A k6 script that initiates a WebSocket connection, sends a ping, and closes it using the onopen handler. The console should log connection is alive, since the recipient should automatically emit the pong event.
The preceding example uses a WebSocket echo server, which you can run with the following command: