| Home | Libraries | People | FAQ | More

###### websocket::stream::ping (1 of 2 overloads)

Send a websocket ping control frame.

<h7> Synopsis </h7>

    void
    ping(
        ping_data const& payload);

<h7> Description </h7>

This function is used to send a ping frame, which usually elicits an automatic pong control frame response from the peer. The call blocks until one of the following conditions is true:

- The ping frame is written.
- An error occurs.

The algorithm, known as a composed operation, is implemented in terms of calls to the next layer's `write_some` function.

<h7> Parameters </h7>

Name | Description
--- | ---
`payload` | The payload of the ping message, which may be empty.

<h7> Exceptions </h7>

Type | Thrown On
--- | ---
`system_error` | Thrown on failure.