class Rpc
C++
class Rpc
The runtime: listeners, sessions and POAs. Create it with RpcBuilder.
auto rpc = nprpc::RpcBuilder().with_tcp(15000).build();
auto poa = rpc->create_poa().build();
auto oid = poa->activate_object(new CalculatorImpl(),
nprpc::ObjectActivationFlags::tcp);
rpc->run();
include/nprpc/nprpc.hpp:589
Methods
virtual void add_to_host_json(std::string_view name, const ObjectId &object_id) = 0
Adds (or replaces) an entry in host.json, which tells browser clients
which objects to connect to. Throws Exception for an empty name.
include/nprpc/nprpc.hpp:606
virtual void clear_host_json() = 0
Removes every host.json entry.
include/nprpc/nprpc.hpp:608
PoaBuilder create_poa()
Starts configuring a new POA.
include/nprpc/nprpc.hpp:593
virtual void destroy() = 0
Stops every listener and the event loop, and frees the runtime.
include/nprpc/nprpc.hpp:603
virtual void destroy_poa(Poa *poa) = 0
Removes a POA created by PoaBuilder::build().
include/nprpc/nprpc.hpp:595
virtual ObjectPtr<common::Nameserver> get_nameserver(std::string_view nameserver_ip) = 0
A proxy for the npnameserver at nameserver_ip (TCP port 15000 or
WebSocket port 15001, whichever transports are compiled in).
include/nprpc/nprpc.hpp:614
virtual SessionContext *get_object_session_context(Object *obj) = 0
The session calls to obj go through, or nullptr if none is open.
include/nprpc/nprpc.hpp:616
virtual boost::asio::io_context &ioc() noexcept = 0
The Boost.Asio context the runtime's I/O runs on.
include/nprpc/nprpc.hpp:597
virtual std::string produce_host_json(std::string_view output_path = {}) = 0
Writes host.json to output_path, or to the HTTP root when empty, and
returns the path written. Throws Exception if neither is set.
include/nprpc/nprpc.hpp:611
virtual void run() = 0
Runs the event loop on the calling thread until destroy().
include/nprpc/nprpc.hpp:601
virtual void start_thread_pool(size_t thread_count) noexcept = 0
Runs the event loop on thread_count background threads and returns.
include/nprpc/nprpc.hpp:599