| Home | Libraries | People | FAQ | More

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

Send a websocket ping control frame.

Synopsis

    void
    ping(
        ping_data const& payload);

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.

Exceptions

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