Commit b19bd718 authored by Hubert Denkmair's avatar Hubert Denkmair

send gameinfo frames to websocket clients for testing

parent 658c7ab1
......@@ -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;
......
......@@ -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;
......
#include "WebsocketConnection.h"
#include "TcpProtocol.h"
#include "MsgPackProtocol.h"
WebsocketConnection::WebsocketConnection(int socket, WebsocketServer::connection_ptr websocket)
: _socket(socket), _websocket(websocket)
......@@ -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());
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment