ping / pong support / fix bug in dispatching received message type
This commit is contained in:
parent
eae2f7d113
commit
208c693088
@ -70,6 +70,18 @@ namespace
|
||||
<< str;
|
||||
log(ss.str());
|
||||
}
|
||||
else if (messageType == ix::WebSocket_MessageType_Ping)
|
||||
{
|
||||
ss << "ws_connect: received ping message: "
|
||||
<< str;
|
||||
log(ss.str());
|
||||
}
|
||||
else if (messageType == ix::WebSocket_MessageType_Pong)
|
||||
{
|
||||
ss << "ws_connect: received pong message: "
|
||||
<< str;
|
||||
log(ss.str());
|
||||
}
|
||||
else if (messageType == ix::WebSocket_MessageType_Error)
|
||||
{
|
||||
ss << "Connection error: " << error.reason << std::endl;
|
||||
@ -78,7 +90,7 @@ namespace
|
||||
ss << "HTTP Status: " << error.http_status << std::endl;
|
||||
log(ss.str());
|
||||
}
|
||||
else if (messageType == ix::WebSocket_MessageType_Pong)
|
||||
else
|
||||
{
|
||||
ss << "Invalid ix::WebSocketMessageType";
|
||||
log(ss.str());
|
||||
|
@ -1,4 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
test -d build || {
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake ..
|
||||
}
|
||||
(cd build ; make)
|
||||
./build/ping_pong ws://localhost:5678
|
||||
|
@ -199,7 +199,7 @@ namespace ix {
|
||||
} break;
|
||||
}
|
||||
|
||||
_onMessageCallback(WebSocket_MessageType_Message, msg, WebSocketErrorInfo());
|
||||
_onMessageCallback(webSocketMessageType, msg, WebSocketErrorInfo());
|
||||
|
||||
WebSocket::invokeTrafficTrackerCallback(msg.size(), true);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user