@@ -50,17 +50,17 @@ void send_message(signalr::hub_connection& connection, const std::string& messag
50
50
51
51
void chat ()
52
52
{
53
- signalr::hub_connection connection = signalr::hub_connection_builder::create (" http://localhost:5000/default" )
54
- .with_logging (std::make_shared <logger>(), signalr::trace_level::verbose)
53
+ std::shared_ptr< signalr::hub_connection> connection = signalr::hub_connection_builder::create (" http://localhost:5000/default" )
54
+ .with_logging (std::make_shared<logger>(), signalr::trace_level::verbose)
55
55
.build ();
56
56
57
- connection. on (" Send" , [](const std::vector<signalr::value>& m)
57
+ connection-> on (" Send" , [](const std::vector<signalr::value>& m)
58
58
{
59
59
std::cout << std::endl << m[0 ].as_string () << std::endl << " Enter your message: " ;
60
60
});
61
61
62
62
std::promise<void > task;
63
- connection. start ([&connection, &task](std::exception_ptr exception )
63
+ connection-> start ([&connection, &task](std::exception_ptr exception )
64
64
{
65
65
if (exception )
66
66
{
@@ -77,20 +77,20 @@ void chat()
77
77
}
78
78
79
79
std::cout << " Enter your message:" ;
80
- while (connection. get_connection_state () == signalr::connection_state::connected)
80
+ while (connection-> get_connection_state () == signalr::connection_state::connected)
81
81
{
82
82
std::string message;
83
83
std::getline (std::cin, message);
84
84
85
- if (message == " :q" || connection. get_connection_state () != signalr::connection_state::connected)
85
+ if (message == " :q" || connection-> get_connection_state () != signalr::connection_state::connected)
86
86
{
87
87
break ;
88
88
}
89
89
90
- send_message (connection, message);
90
+ // send_message(connection, message);
91
91
}
92
92
93
- connection. stop ([&task](std::exception_ptr exception )
93
+ connection-> stop ([&task](std::exception_ptr exception )
94
94
{
95
95
try
96
96
{
0 commit comments