web_connect.h 740 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef WEB_CONNECT_H
  2. #define WEB_CONNECT_H
  3. #include<atomic>
  4. #include<vector>
  5. #include<string>
  6. #include<memory>
  7. #include"sio_message.h"
  8. #include"wsClient.h"
  9. class web_connect
  10. {
  11. public:
  12. web_connect();
  13. static void init(const std::vector<std::string>&uri_list,int32_t st, std::map<std::string, YA::MSG_HANDLE_FUNC_TYPE>& MsgFuncList);
  14. static void start_beatheart_monitor();
  15. static bool connect();
  16. static void close();
  17. private:
  18. static void _beatheart_callback( int ID, std::string const& name,
  19. sio::message::ptr const& data, bool need_ack, sio::message::list &ack_resp );
  20. static void _beatheart_thread();
  21. static std::atomic<int> _beatheart_count;
  22. };
  23. #endif // WEB_CONNECT_H