Example #1
0
/**
    Fired when client sends data
 */
int SocketDwarf::Server::DwarfServer::OnClientDataReceived(struct mg_connection * conn, const std::string & data)
{
    const std::string & sessionId = Session::GetSessionId (conn);
    Session * session = GetSessionById (sessionId);
    if (session == 0)
        return WEBSOCKET_OPCODE_CONNECTION_CLOSE;
    std::lock_guard<std::mutex> lock(* session);    
    return session->OnClientDataReceived (data);
}