a8/a8/websocketsession.h
2019-05-18 16:52:38 +08:00

34 lines
990 B
C++

#ifndef A8_WEBSOCKETSESSION_H
#define A8_WEBSOCKETSESSION_H
#include <a8/basehttpsession.h>
namespace a8
{
class WebSocketSession: public BaseHttpSession
{
public:
virtual void SendBuff(const char* buff, unsigned int bufflen) override;
protected:
virtual void Reset() override;
virtual void Destory() override;
virtual void DecodePacket(char* buf, int& offset, unsigned int buflen) override;
virtual bool HandleRedirect(const std::string& url, const std::string& querystr,
std::string& location);
void ProcessHandShake(char* buf, int& offset, unsigned int buflen);
void ProcessWsHandShake(char* buf, int& offset, unsigned int buflen);
void ProcessUserPacket();
void DecodeFrame(char* buf, int& offset, unsigned int buflen);
private:
char *decoded_buff_ = nullptr;
int decoded_bufflen_ = 0;
bool handshook_ = false;
};
}
#endif