Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
testee_client.cpp File Reference
Include dependency graph for testee_client.cpp:

Go to the source code of this file.

Classes

struct  deflate_config
 
struct  deflate_config::transport_config
 
struct  deflate_config::permessage_deflate_config
 permessage_compress extension More...
 

Typedefs

typedef websocketpp::client< deflate_configclient
 

Functions

void on_message (client *c, websocketpp::connection_hdl hdl, message_ptr msg)
 
int main (int argc, char *argv[])
 

Variables

int case_count = 0
 

Typedef Documentation

◆ client

Definition at line 72 of file testee_client.cpp.

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 95 of file testee_client.cpp.

95 {
96 // Create a server endpoint
97 client c;
98
99 std::string uri = "ws://localhost:9001";
100
101 if (argc == 2) {
102 uri = argv[1];
103 }
104
105 try {
106 // We expect there to be a lot of errors, so suppress them
109
110 // Initialize ASIO
111 c.init_asio();
112
113 // Register our handlers
114 c.set_message_handler(bind(&on_message,&c,::_1,::_2));
115
116 websocketpp::lib::error_code ec;
117 client::connection_ptr con = c.get_connection(uri+"/getCaseCount", ec);
118 c.connect(con);
119
120 // Start the ASIO io_service run loop
121 c.run();
122
123 std::cout << "case count: " << case_count << std::endl;
124
125 for (int i = 1; i <= case_count; i++) {
126 c.reset();
127
128 std::stringstream url;
129
130 url << uri << "/runCase?case=" << i << "&agent="
131 << websocketpp::user_agent;
132
133 con = c.get_connection(url.str(), ec);
134
135 c.connect(con);
136
137 c.run();
138 }
139
140 std::cout << "done" << std::endl;
141
142 } catch (websocketpp::exception const & e) {
143 std::cout << e.what() << std::endl;
144 }
145}
connection_ptr connect(connection_ptr con)
Begin the connection process for the given connection.
connection_ptr get_connection(uri_ptr location, lib::error_code &ec)
Get a new connection.
void set_message_handler(message_handler h)
Definition endpoint.hpp:322
void clear_access_channels(log::level channels)
Clear Access logging channels.
Definition endpoint.hpp:231
void clear_error_channels(log::level channels)
Clear Error logging channels.
Definition endpoint.hpp:253
virtual char const * what() const
Definition error.hpp:263
char ** argv
string url
Definition main.cpp:166
static level const all
Special aggregate value representing "all levels".
Definition levels.hpp:152
static level const all
Special aggregate value representing "all levels".
Definition levels.hpp:80
void on_message(client *c, websocketpp::connection_hdl hdl, message_ptr msg)
int case_count
Here is the call graph for this function:

◆ on_message()

void on_message ( client * c,
websocketpp::connection_hdl hdl,
message_ptr msg )

Definition at line 83 of file testee_client.cpp.

83 {
85
86 if (con->get_resource() == "/getCaseCount") {
87 std::cout << "Detected " << msg->get_payload() << " test cases."
88 << std::endl;
89 case_count = atoi(msg->get_payload().c_str());
90 } else {
91 c->send(hdl, msg->get_payload(), msg->get_opcode());
92 }
93}
connection_ptr get_con_from_hdl(connection_hdl hdl, lib::error_code &ec)
Retrieves a connection_ptr from a connection_hdl (exception free)
Definition endpoint.hpp:643
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)
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ case_count

int case_count = 0

Definition at line 81 of file testee_client.cpp.