add stop and start directives to ws_connect + display close info
This commit is contained in:
parent
5b333f91f6
commit
9c81eeace0
@ -65,7 +65,10 @@ namespace
|
|||||||
}
|
}
|
||||||
else if (messageType == ix::WebSocket_MessageType_Close)
|
else if (messageType == ix::WebSocket_MessageType_Close)
|
||||||
{
|
{
|
||||||
log("ws_connect: disconnected");
|
ss << "ws_connect: connection closed:";
|
||||||
|
ss << " code " << closeInfo.code;
|
||||||
|
ss << " reason " << closeInfo.reason << std::endl;
|
||||||
|
log(ss.str());
|
||||||
}
|
}
|
||||||
else if (messageType == ix::WebSocket_MessageType_Message)
|
else if (messageType == ix::WebSocket_MessageType_Message)
|
||||||
{
|
{
|
||||||
@ -108,6 +111,20 @@ namespace
|
|||||||
std::cout << "> " << std::flush;
|
std::cout << "> " << std::flush;
|
||||||
std::getline(std::cin, text);
|
std::getline(std::cin, text);
|
||||||
|
|
||||||
|
if (text == "/stop")
|
||||||
|
{
|
||||||
|
std::cout << "Stopping connection..." << std::endl;
|
||||||
|
webSocketChat.stop();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (text == "/start")
|
||||||
|
{
|
||||||
|
std::cout << "Starting connection..." << std::endl;
|
||||||
|
webSocketChat.start();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!std::cin)
|
if (!std::cin)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user