| Home | Libraries | People | FAQ | More

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

Send a websocket ping control frame.

###### Synopsis

    void
    ping(
        ping_data const& payload,
        error_code& ec);

###### Description

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.

###### Parameters

Name | Description
--- | ---
`payload` | The payload of the ping message, which may be empty.
`ec` | Set to indicate what error occurred, if any.