proxy-sys
SystemService::ProxySys
struct SystemService::ProxySys {
const AccountNumber service;
registerServer(...); // Register sender's subdomain
};
The proxy-sys service routes HTTP requests to the appropriate service.
Rule set:
- If the target starts with
/common, then route the request to SystemService::CommonSys. - Else if there's a subdomain and it references a registered service, then route the request to that service.
- Else if the request references an unregistered subdomain, then route the request to
psispace-sys. - Else route the request to CommonSys; this handles the chain's main domain.
See C++ Web Services or Rust Web Services for more detail, including how to write services which serve HTTP requests.
serve export (not an action)
This service has the following WASM exported function:
extern "C" [[clang::export_name("serve")]] void serve()
psinode calls this function on the proxy-sys service whenever it receives
an HTTP request that services may serve. This function does the actual routing.
psinode has a local option (TODO: implement) which may choose an alternative
routing service instead.
SystemService::ProxySys::registerServer
void SystemService::ProxySys::registerServer(
psibase::AccountNumber server
);
Register sender's subdomain.
When requests are made to the sender service subdomain, proxy-sys will
forward the request into the serveSys action of the specified server
for it to handle the request.
Registered services may optionally:
- Serve files via HTTP
- Respond to RPC requests
- Respond to GraphQL requests