Loading relayserver/TcpProtocol.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,11 @@ bool TcpProtocol::Read(int socket) return true; } const MsgPackProtocol::GameInfoMessage &TcpProtocol::GetGameInfo() const { return _gameInfo; } void TcpProtocol::OnMessageReceived(const char* data, size_t count) { msgpack::object_handle obj; Loading relayserver/TcpProtocol.h +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ class TcpProtocol void SetFrameCompleteCallback(FrameCompleteCallback callback); bool Read(int socket); const MsgPackProtocol::GameInfoMessage& GetGameInfo() const; private: static constexpr const size_t SPATIAL_MAP_TILES_X = 128; static constexpr const size_t SPATIAL_MAP_TILES_Y = 128; Loading relayserver/WebsocketConnection.cpp +5 −1 Original line number Diff line number Diff line #include "WebsocketConnection.h" #include "TcpProtocol.h" #include "MsgPackProtocol.h" WebsocketConnection::WebsocketConnection(int socket, WebsocketServer::connection_ptr websocket) : _socket(socket), _websocket(websocket) Loading @@ -17,5 +19,7 @@ void WebsocketConnection::DataReceived(const char *data, size_t count) void WebsocketConnection::FrameComplete(uint64_t frame_id, const TcpProtocol &proto) { msgpack::sbuffer buf; msgpack::pack(buf, proto.GetGameInfo()); _websocket->send(buf.data(), buf.size()); } Loading
relayserver/TcpProtocol.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,11 @@ bool TcpProtocol::Read(int socket) return true; } const MsgPackProtocol::GameInfoMessage &TcpProtocol::GetGameInfo() const { return _gameInfo; } void TcpProtocol::OnMessageReceived(const char* data, size_t count) { msgpack::object_handle obj; Loading
relayserver/TcpProtocol.h +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ class TcpProtocol void SetFrameCompleteCallback(FrameCompleteCallback callback); bool Read(int socket); const MsgPackProtocol::GameInfoMessage& GetGameInfo() const; private: static constexpr const size_t SPATIAL_MAP_TILES_X = 128; static constexpr const size_t SPATIAL_MAP_TILES_Y = 128; Loading
relayserver/WebsocketConnection.cpp +5 −1 Original line number Diff line number Diff line #include "WebsocketConnection.h" #include "TcpProtocol.h" #include "MsgPackProtocol.h" WebsocketConnection::WebsocketConnection(int socket, WebsocketServer::connection_ptr websocket) : _socket(socket), _websocket(websocket) Loading @@ -17,5 +19,7 @@ void WebsocketConnection::DataReceived(const char *data, size_t count) void WebsocketConnection::FrameComplete(uint64_t frame_id, const TcpProtocol &proto) { msgpack::sbuffer buf; msgpack::pack(buf, proto.GetGameInfo()); _websocket->send(buf.data(), buf.size()); }