Use hash in switch method instead of map list

This commit is contained in:
dijunkun
2023-08-16 16:01:53 +08:00
parent 481f6af9e7
commit c46396a18a
8 changed files with 151 additions and 76 deletions

View File

@@ -0,0 +1,24 @@
#ifndef _WS_HANDLE_MANAGER_H_
#define _WS_HANDLE_MANAGER_H_
#include <iostream>
#include <websocketpp/server.hpp>
class WsHandleManager {
public:
WsHandleManager();
~WsHandleManager();
public:
bool BindHandleToConnection(websocketpp::connection_hdl hdl,
std::string& connection_id);
bool ReleaseHandleFromConnection(websocketpp::connection_hdl hdl,
std::string& connection_id);
const std::string& GetConnectionId(websocketpp::connection_hdl hdl);
websocketpp::connection_hdl GetWsHandle(std::string& connection_id);
private:
};
#endif