#include "SockIoServer.h" #include "SockIoUser.h" #include "base/HGInfo.h" namespace ver_1 { SockIoServer::SockIoServer(HGMsgPump msgPump, ManagerV1* manager) : WebServer(msgPump) { m_manager = manager; } SockIoServer::~SockIoServer() { } ManagerV1* SockIoServer::GetManger() { return m_manager; } void SockIoServer::Connect(const ConnectParam* param) { assert(NULL != param && this == param->svr); WebUser* user = new SockIoUser(this, m_currUserId, param->ip, param->port, param->socket); user->Open(); ++m_currUserId; m_vectorUser.push_back(user); } void SockIoServer::Command(const SockIoCmdParam* param) { assert(NULL != param && this == param->svr); int nIndex = GetUserIndex(param->usrId); if (-1 != nIndex) { ((SockIoUser*)m_vectorUser[nIndex])->HandleCmd(param); } } void SockIoServer::Event(const SockIoEvtParam* param) { assert(NULL != param && this == param->svr); int nIndex = GetUserIndex(param->usrId); if (-1 != nIndex) { ((SockIoUser*)m_vectorUser[nIndex])->HandleEvent(param); } } }