91 [[nodiscard]]
bool running() const noexcept;
133 binding::IView& v, std::function<
void(std::string_view)> cb)
override;
148 binding::IView& v, std::function<
void(std::int64_t)> cb)
override;
153 binding::IView& v, std::function<
void(std::uint64_t)> cb)
override;
176 std::function<std::string(std::string_view args_json)>;
183 std::string_view command_name,
188 std::string_view command_name);
218 std::shared_ptr<Impl> p_;
RAII handle to a single subscription.
Definition subscription.hpp:44
bool start()
Start the HTTP server on a background thread.
bool get_bool(binding::IView &v) override
std::uint64_t get_uint64(binding::IView &v) override
HttpView * find_view(std::string_view id)
Look up a previously-registered view by id, or nullptr.
void set_float(binding::IView &v, float value) override
void set_double(binding::IView &v, double value) override
::aria::Subscription on_click(binding::IView &v, std::function< void()> cb) override
void unregister_command(std::string_view view_id, std::string_view command_name)
Unregister a previously-registered command.
double get_double(binding::IView &v) override
std::size_t client_count() const noexcept
Number of currently connected SSE clients.
::httplib::Server & native_server() noexcept
Direct access to the underlying cpp-httplib server, for consumers that want to register their own RES...
HttpAdapter(const HttpAdapter &)=delete
HttpAdapter(HttpAdapterConfig config={})
HttpAdapter & operator=(const HttpAdapter &)=delete
std::uint16_t actual_port() const noexcept
Actual bound port — useful when config.port == 0 and the OS picked.
void set_uint64(binding::IView &v, std::uint64_t value) override
void set_text(binding::IView &v, std::string_view text) override
bool running() const noexcept
True iff the server thread is alive and listening.
::aria::Subscription on_text_changed(binding::IView &v, std::function< void(std::string_view)> cb) override
float get_float(binding::IView &v) override
::aria::Subscription on_bool_changed(binding::IView &v, std::function< void(bool)> cb) override
void register_command(std::string_view view_id, std::string_view command_name, CommandHandler handler)
Register a custom command.
void set_int(binding::IView &v, int value) override
HttpView & register_view(std::string id, std::string kind)
Register a logical view with stable id and kind.
HttpAdapter(HttpAdapter &&)=delete
void set_int64(binding::IView &v, std::int64_t value) override
::aria::Subscription on_int_changed(binding::IView &v, std::function< void(int)> cb) override
std::int64_t get_int64(binding::IView &v) override
void set_visible(binding::IView &v, bool visible) override
std::vector< ViewInfo > list_views() const
void set_enabled(binding::IView &v, bool enabled) override
std::function< std::string(std::string_view args_json)> CommandHandler
Custom command handler signature.
Definition http_adapter.hpp:175
void unregister_view(std::string_view id)
Unregister a view (also fires its on_destroy signal so any BindingEngine subscriptions are released c...
::aria::Subscription on_int64_changed(binding::IView &v, std::function< void(std::int64_t)> cb) override
::aria::Subscription on_float_changed(binding::IView &v, std::function< void(float)> cb) override
std::string_view platform_name() const noexcept override
Definition http_adapter.hpp:126
std::string get_text(binding::IView &v) override
void set_bool(binding::IView &v, bool value) override
void stop()
Stop the server; closes all SSE connections.
HttpAdapter & operator=(HttpAdapter &&)=delete
int get_int(binding::IView &v) override
::aria::Subscription on_uint64_changed(binding::IView &v, std::function< void(std::uint64_t)> cb) override
::aria::Subscription on_double_changed(binding::IView &v, std::function< void(double)> cb) override
Logical view exposed over HTTP.
Definition http_view.hpp:29
Abstract platform adapter — knows how to read/write/observe widgets.
Definition view_adapter.hpp:80
Abstract platform widget reference.
Definition view_adapter.hpp:28
#define ARIA_HTTP_API
Definition export.hpp:66
Configuration for the HTTP adapter.
Logical "view" exposed over HTTP/REST/SSE.
Definition http_adapter.hpp:67
Definition http_adapter.hpp:65
Definition validation_key.hpp:110
Snapshot of currently registered (id, kind) pairs.
Definition http_adapter.hpp:118
std::string kind
Definition http_adapter.hpp:120
std::string id
Definition http_adapter.hpp:119
Configuration for HttpAdapter.
Definition http_config.hpp:15