#ifndef HV_WEBSOCKET_PARSER_H_ #define HV_WEBSOCKET_PARSER_H_ #include "hexport.h" #include #include #include enum websocket_parser_state { WS_FRAME_BEGIN, WS_FRAME_HEADER, WS_FRAME_BODY, WS_FRAME_END, WS_FRAME_FIN, }; struct websocket_parser; class HV_EXPORT WebSocketParser { public: websocket_parser* parser; websocket_parser_state state; int opcode; std::string message; std::function onMessage; WebSocketParser(); ~WebSocketParser(); int FeedRecvData(const char* data, size_t len); }; typedef std::shared_ptr WebSocketParserPtr; #endif // HV_WEBSOCKET_PARSER_H_