Loading relayserver/RelayServer.cpp +12 −9 Original line number Diff line number Diff line Loading @@ -2,8 +2,7 @@ #include <iostream> #include <string> #include <TcpServer/EPoll.h> #include <nlohmann/json.hpp> using nlohmann::json; #include "JsonProtocol.h" RelayServer::RelayServer() { Loading Loading @@ -38,18 +37,22 @@ int RelayServer::Run() con->FrameComplete(frame_id, _tcpProtocol); auto key = con->getViewerKey(); if (logMessages.find(key) == logMessages.end()) if (logMessages.find(key) != logMessages.end()) { return; } for (auto& item: logMessages.at(key)) { con->LogMessage(frame_id, item.message); } } } ); _tcpProtocol.ClearLogItems(); for (auto& msg: _tcpProtocol.GetPendingMessages()) { std::string s = json(*msg).dump(); h.getDefaultGroup<uWS::SERVER>().broadcast(s.data(), s.length(), uWS::OpCode::TEXT); } } ); epoll.AddFileDescriptor(_clientSocket, EPOLLIN|EPOLLPRI|EPOLLERR); Loading relayserver/WebsocketConnection.cpp +0 −6 Original line number Diff line number Diff line Loading @@ -16,12 +16,6 @@ void WebsocketConnection::FrameComplete(uint64_t frame_id, const TcpProtocol &pr sendInitialData(proto); _firstFrameSent = true; } msgpack::sbuffer buf; for (auto& msg: proto.GetPendingMessages()) { sendString(json(*msg).dump()); } } void WebsocketConnection::LogMessage(uint64_t frame_id, const std::string &message) Loading Loading
relayserver/RelayServer.cpp +12 −9 Original line number Diff line number Diff line Loading @@ -2,8 +2,7 @@ #include <iostream> #include <string> #include <TcpServer/EPoll.h> #include <nlohmann/json.hpp> using nlohmann::json; #include "JsonProtocol.h" RelayServer::RelayServer() { Loading Loading @@ -38,18 +37,22 @@ int RelayServer::Run() con->FrameComplete(frame_id, _tcpProtocol); auto key = con->getViewerKey(); if (logMessages.find(key) == logMessages.end()) if (logMessages.find(key) != logMessages.end()) { return; } for (auto& item: logMessages.at(key)) { con->LogMessage(frame_id, item.message); } } } ); _tcpProtocol.ClearLogItems(); for (auto& msg: _tcpProtocol.GetPendingMessages()) { std::string s = json(*msg).dump(); h.getDefaultGroup<uWS::SERVER>().broadcast(s.data(), s.length(), uWS::OpCode::TEXT); } } ); epoll.AddFileDescriptor(_clientSocket, EPOLLIN|EPOLLPRI|EPOLLERR); Loading
relayserver/WebsocketConnection.cpp +0 −6 Original line number Diff line number Diff line Loading @@ -16,12 +16,6 @@ void WebsocketConnection::FrameComplete(uint64_t frame_id, const TcpProtocol &pr sendInitialData(proto); _firstFrameSent = true; } msgpack::sbuffer buf; for (auto& msg: proto.GetPendingMessages()) { sendString(json(*msg).dump()); } } void WebsocketConnection::LogMessage(uint64_t frame_id, const std::string &message) Loading