TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
viewer_server.hpp File Reference

HTTP + WebSocket server for the live viewer (design doc 09, protocol in docs/13-viewer-protocol.md). More...

#include <cstddef>
#include <cstdint>
#include <memory>
#include <string>
#include "core/events.hpp"

Go to the source code of this file.

Classes

struct  tmk::server::ServerOptions
class  tmk::server::ViewerServer
struct  tmk::server::ViewerServer::Counters

Namespaces

namespace  tmk
namespace  tmk::server

Functions

std::string tmk::server::default_host ()
 Who can reach the viewer (issue #4, docs/09-visualization.md "Security", D116): by default only this machine.
std::string tmk::server::default_web_root ()
 Default directory of the built viewer: $TM_VIEW_DIR, else <prefix>/share/tracemaker/viewer for a binary in <prefix>/bin, else <repo>/viewer/dist.

Detailed Description

HTTP + WebSocket server for the live viewer (design doc 09, protocol in docs/13-viewer-protocol.md).

Serves the built viewer (static files) at http://<host>:<port>/ and streams protocol messages at /ws. publish() is thread-safe and never blocks on the network: messages are queued and fanned out by a single background I/O thread. The server keeps the latest board snapshot plus the state changes since it, so a client that connects mid-run sees the current scene. Slow clients lose transient messages (frontier, path_try) and get coalesced stats; a client that falls hopelessly behind is disconnected (it reconnects and receives a fresh snapshot).

Definition in file viewer_server.hpp.