35 using websocketpp::lib::placeholders::_1;
36 using websocketpp::lib::placeholders::_2;
37 using websocketpp::lib::bind;
45 std::cout <<
"on_message called with hdl: " << hdl.lock().get()
46 <<
" and message: " << msg->get_payload()
50 websocketpp::lib::error_code ec;
52 c->
send(hdl, msg->get_payload(), msg->get_opcode(), ec);
54 std::cout <<
"Echo failed because: " << ec.message() << std::endl;
58 int main(
int argc,
char* argv[]) {
62 std::string uri =
"ws://localhost:9002";
79 websocketpp::lib::error_code ec;
82 std::cout <<
"could not create connection because: " << ec.message() << std::endl;
95 std::cout << e.
what() << std::endl;
static level const all
Special aggregate value representing "all levels".
connection_type::ptr connection_ptr
Type of a shared pointer to the connections this server will create.
websocketpp::config::asio_tls_client::message_type::ptr message_ptr
void on_message(client *c, websocketpp::connection_hdl hdl, message_ptr msg)
websocketpp::client< websocketpp::config::asio_client > client
static level const frame_payload
One line per frame, includes the full message payload (warning: chatty)
lib::weak_ptr< void > connection_hdl
A handle to uniquely identify a connection.
connection_ptr connect(connection_ptr con)
Begin the connection process for the given connection.
lib::shared_ptr< message > ptr
websocketpp::config::asio_client::message_type::ptr message_ptr
void set_access_channels(log::level channels)
Set Access logging channel.
int main(int argc, char *argv[])
void clear_access_channels(log::level channels)
Clear Access logging channels.
void set_message_handler(message_handler h)
virtual char const * what() const
void send(connection_hdl hdl, std::string const &payload, frame::opcode::value op, lib::error_code &ec)
Create a message and add it to the outgoing send queue (exception free)
connection_ptr get_connection(uri_ptr location, lib::error_code &ec)
Get a new connection.