noos::cloud::asio_http Class Reference

ASIO socket controller asynchronous http websockets used for cloud service calls. More...

#include <asio_http.hpp>

Public Member Functions

 asio_http (std::function< void(std::string)> cloud_callback, std::function< void(error_code)> error_callback, boost::asio::io_service &io_service, const bool keep_alive, boost::asio::streambuf &request)
 constructor More...
 
void begin (boost::asio::ip::tcp::resolver::query &query, boost::asio::ip::tcp::resolver &resolver, unsigned int timeout)
 begin connection More...
 
void send (boost::asio::ip::tcp::resolver::query &query, boost::asio::ip::tcp::resolver &resolver, unsigned int timeout, boost::asio::streambuf &request)
 send data in an existing connection More...
 
void shutdown (boost::system::error_code)
 shutdown connection
 
void stop_timeout ()
 stop timeout timer
 
bool is_connected () const
 
- Public Member Functions inherited from noos::cloud::asio_handler< http_socket, asio_http >
 asio_handler (const bool keep_alive, std::function< void(error_code)> error_callback)
 construct by callbacks and socket T pointer More...
 
void set_socket (const std::shared_ptr< http_socket > socket)
 set socket pointer
 
void write_request (const boost::system::error_code &err, const std::size_t bytes)
 write the cloud request to the socket More...
 
void read_status_line (const boost::system::error_code &err, const std::size_t bytes)
 read first HTTP line and check for a 200 response More...
 
void read_headers (const boost::system::error_code &err, const std::size_t bytes)
 read HTTP headers and validate More...
 
void read_content (const boost::system::error_code &err, const std::size_t bytes)
 strip the header and read the POST data More...
 
void end (const boost::system::error_code &err)
 close socket and cleanup members More...
 

Detailed Description

ASIO socket controller asynchronous http websockets used for cloud service calls.

Version
0.7.2
Date
15 December 2016
Author
Alex Giokas a.gki.nosp@m.okas.nosp@m.@orte.nosp@m.lio..nosp@m.co.uk
See also
asio_handler
http_request
http_response
Inheritance diagram for noos::cloud::asio_http:
Collaboration diagram for noos::cloud::asio_http:

Constructor & Destructor Documentation

noos::cloud::asio_http::asio_http ( std::function< void(std::string)>  cloud_callback,
std::function< void(error_code)>  error_callback,
boost::asio::io_service &  io_service,
const bool  keep_alive,
boost::asio::streambuf &  request 
)

constructor

cloud_function is the virtual json_parser::deserialize receiving the data error_function is the handler which may receive the errors io_service is the ASIO service controller request is a stream buffer containing the request

Member Function Documentation

void noos::cloud::asio_http::begin ( boost::asio::ip::tcp::resolver::query &  query,
boost::asio::ip::tcp::resolver &  resolver,
unsigned int  timeout 
)

begin connection

Parameters
querydefines the URL/URI
resolverresolves the URL/URI address
io_serviceis the queue on which jobs are scheduled
void noos::cloud::asio_http::send ( boost::asio::ip::tcp::resolver::query &  query,
boost::asio::ip::tcp::resolver &  resolver,
unsigned int  timeout,
boost::asio::streambuf &  request 
)

send data in an existing connection

Parameters
querydefines the URL/URI
resolverresolves the URL/URI address
io_serviceis the queue on which jobs are scheduled
bool noos::cloud::asio_http::is_connected ( ) const
Returns
if socket is connected

The documentation for this class was generated from the following file: