drogon/examples/simple_example/WebSocketTest.cc

18 lines
585 B
C++

#include "WebSocketTest.h"
using namespace example;
void WebSocketTest::handleNewMessage(const WebSocketConnectionPtr &wsConnPtr, std::string &&message)
{
//write your application logic here
LOG_DEBUG << "new websocket message:" << message;
}
void WebSocketTest::handleConnectionClosed(const WebSocketConnectionPtr &)
{
LOG_DEBUG << "websocket closed!";
}
void WebSocketTest::handleNewConnection(const HttpRequestPtr &,
const WebSocketConnectionPtr &conn)
{
LOG_DEBUG << "new websocket connection!";
conn->send("haha!!!");
}