Messages may also be read asynchronously. When performing asynchronous stream read operations the stream, buffer, and message variables must remain valid until the operation has completed. Beast asynchronous initiation functions use Asio's completion handler model. This call reads a message asynchronously and reports the error code upon completion. The handler is called with the error, set to any that occurs, and the number of bytes parsed. This number may be used to measure the relative amount of work performed, or it may be ignored as this example shows.
Messages may also be read asynchronously. When performing asynchronous stream read operations the stream, buffer, and message variables must remain valid until the operation has completed. Beast asynchronous initiation functions use Asio's completion handler model. This call reads a message asynchronously and reports the error code upon completion. The handler is called with the error, set to any that occurs, and the number of bytes parsed. This number may be used to measure the relative amount of work performed, or it may be ignored as this example shows.