Websocket

an-tao 2021-07-25 09:46:04 +08:00
parent 87614e6093
commit e1d6f74017
2 changed files with 8 additions and 4 deletions

@ -61,7 +61,8 @@ class EchoWebsock:public drogon::WebSocketController<EchoWebsock>
{
public:
virtual void handleNewMessage(const WebSocketConnectionPtr&,
std::string &&)override;
std::string &&,
const WebSocketMessageType &)override;
virtual void handleNewConnection(const HttpRequestPtr &,
const WebSocketConnectionPtr&)override;
virtual void handleConnectionClosed(const WebSocketConnectionPtr&)override;
@ -100,7 +101,8 @@ void EchoWebsock::handleConnectionClosed(const WebSocketConnectionPtr &wsConnPtr
```c++
virtual void handleNewConnection(const HttpRequestPtr &req,const WebSocketConnectionPtr &wsConn);
virtual void handleNewMessage(const WebSocketConnectionPtr &wsConn,std::string &&message);
virtual void handleNewMessage(const WebSocketConnectionPtr &wsConn,std::string &&message,
const WebSocketMessageType &);
virtual void handleConnectionClosed(const WebSocketConnectionPtr &wsConn);
```

@ -63,7 +63,8 @@ class EchoWebsock:public drogon::WebSocketController<EchoWebsock>
{
public:
virtual void handleNewMessage(const WebSocketConnectionPtr&,
std::string &&)override;
std::string &&,
const WebSocketMessageType &)override;
virtual void handleNewConnection(const HttpRequestPtr &,
const WebSocketConnectionPtr&)override;
virtual void handleConnectionClosed(const WebSocketConnectionPtr&)override;
@ -103,7 +104,8 @@ The user-defined websocket controller class inherits from the `drogon::WebSocket
```c++
virtual void handleNewConnection(const HttpRequestPtr &req,const WebSocketConnectionPtr &wsConn);
virtual void handleNewMessage(const WebSocketConnectionPtr &wsConn,std::string &&message);
virtual void handleNewMessage(const WebSocketConnectionPtr &wsConn,std::string &&message,
const WebSocketMessageType &);
virtual void handleConnectionClosed(const WebSocketConnectionPtr &wsConn);
```