code_app/sdk/webservice/WSUser.h

33 lines
773 B
C++

#pragma once
#include "WebUser.h"
#include "Msg.h"
namespace ver_2
{
class WSUser : public WebUser
{
public:
#if defined(HG_CMP_MSC)
WSUser(WebServer* server, HGUInt id, const std::string& ip, uint16_t port, SOCKET sockConn);
#else
WSUser(WebServer* server, HGUInt id, const std::string& ip, uint16_t port, int sockConn);
#endif
virtual ~WSUser();
ManagerV2* GetManager();
void HandleCmd(const WSCmdParam* param);
void HandleEvent(const WSEvtParam* param);
protected:
void PostCmdMsg(const HGByte* data, HGUInt dataSize);
void PostEventMsg(const HGByte* data, HGUInt dataSize);
virtual void ThreadFunc();
private:
bool ShakeHand(const std::string& head);
void Pong();
bool SendResponse(const HGByte* data, HGUInt size, HGBool text);
};
}