32{
33 std::cout << "=== HTTP Facade Example ===" << std::endl;
34
35
37 srv_config.
port = 8080;
38 srv_config.
server_id =
"example-http-server";
39
40 std::cout << "\n1. Creating HTTP server..." << std::endl;
41 std::cout <<
" Port: " << srv_config.
port << std::endl;
42 std::cout <<
" Server ID: " << srv_config.
server_id << std::endl;
43
45 if (server)
46 {
47 std::cout << " Server created successfully" << std::endl;
48 }
49 else
50 {
51 std::cout << " Server creation returned null (expected in demo)" << std::endl;
52 }
53
54
56 cli_config.
client_id =
"example-http-client";
57 cli_config.
timeout = std::chrono::seconds(30);
59
60 std::cout << "\n2. Creating HTTP client..." << std::endl;
61 std::cout <<
" Client ID: " << cli_config.
client_id << std::endl;
62 std::cout <<
" Timeout: " << cli_config.
timeout.count() <<
"ms" << std::endl;
63 std::cout <<
" SSL: " << (cli_config.
use_ssl ?
"enabled" :
"disabled") << std::endl;
64
66 if (client)
67 {
68 std::cout << " Client created successfully" << std::endl;
69 }
70 else
71 {
72 std::cout << " Client creation returned null (expected in demo)" << std::endl;
73 }
74
75 std::cout << "\nDone." << std::endl;
76 return 0;
77}
auto create_server(const server_config &config) const -> Result< std::shared_ptr< interfaces::i_protocol_server > >
Creates an HTTP server with the specified configuration.
auto create_client(const client_config &config) const -> Result< std::shared_ptr< interfaces::i_protocol_client > >
Creates an HTTP client with the specified configuration.
@ client
Client-side request.
@ server
Server-side handling of a request.
Configuration for creating an HTTP client.
std::string client_id
Client identifier (auto-generated if not provided)
bool use_ssl
Whether to use HTTPS.
std::chrono::milliseconds timeout
Request timeout.
Configuration for creating an HTTP server.
uint16_t port
Port number to listen on.
std::string server_id
Server identifier (optional, auto-generated if not provided)