Softanza
StartFrançais
Softanza
The library documents itself · Web & app server

stzAppServer

61 own methods · 7 forms written with extensions, listed under their method

the source: base/appserver/stzAppServer.ring(opens in a new tab) · All classes · The area reference: Web & app server

Under each method, its extensions (Q CS XT Z ZZ IB W U): bold and ticked, it exists; struck, it does not. The extensions and what they mean

No method of this class is run on this page: the class reaches files, the network, processes, the clock, chance or sound, and an example run here would only be an example of its effects. Each method carries the explanation the library gives of itself.

Method
Explanation, as the source carries it
init
(no comment in the source: the name reads as a sentence) initno extension
Start
Bind the HTTP listener. nPortNum 0 = ephemeral (see Port()). Raises on bind failure -- no silent half-started server.no extension
StartTls
Serve over TLS: the reactor terminates TLS per connection (server cert cCertPath + key cKeyPath) BELOW the router, so every handler runs on the DECRYPTED request and responses are encrypted transparently -- the routing/handler code is byte-for-byte identical to plain Start(). A non-empty cCaPath enables client-cert checks; bRequireClient = TRUE demands a valid client cert (mutual TLS). Same bind semantics as Start.no extension
StartHttps
One-way HTTPS convenience (server cert only, no client cert).no extension
Stop
server lifecycleno extension
IsRunning
server lifecycleno extension
Port
server lifecycleno extension
Host
server lifecycleno extension
Uptime
server lifecycleno extension
RequestCount
server lifecycleno extension
ReactorQ
The underlying reactor as a chainable stz object (Q-convention).no extension
ServeOne
Drain events until ONE data event (an HTTP request or a raw chunk) has been handled, or nTimeoutMs elapses. Returns TRUE if work was done. Accept/closed events are drained silently along the way.no extension
RunFor
With agents hosted, the serve slice is BOUNDED: ServeOne(nLeft) would otherwise park on the socket for the whole remaining time whenever no request arrives, and the agents -- which live on this same loop -- would never tick. So we serve for at most @nAgentSliceMs, then tick whatever is due, and repeat. Requests and perceive-decide-act interleave on ONE loop.no extension
Run
Serve forever (until the process is killed or Stop() is called from a handler). The documented blocking entry point.no extension
Get_
routing interfaceno extension
Post
routing interfaceno extension
Put_
routing interfaceno extension
Delete
routing interfaceno extension
Observe
Observe this server with a perf monitor (perf P3). From this call on, every request records its response time R into the timer 'http.request.ms', its arrival into the counter 'http.requests' (throughput X = its measured rate), and 5xx outcomes into 'http.errors'; GET /metrics serves the monitor's Prometheus exposition, and /health widens with the process senses. The monitor's watched senses (memory/cpu) are ticked by the serve loop at the monitor's own cadence -- a served app samples itself.no extension
IsObserved
routing interfaceno extension
ObserveRoutes
Per-route observation (perf P8): Observe() PLUS a timer FAMILY 'http.route.ms' labeled [method, route, class] -- one child per route the traffic actually exercises, each with its own percentiles ('class' is the status class: 2xx/4xx/5xx). Cardinality rides the family's bound: unruly path spaces land in the overflow child instead of exploding the registry.no extension
Use
routing interfaceno extension
Static
routing interfaceno extension
Expose
Expose a table of an open stzDatabase as a REST resource -- the FULL CRUD floor, keyed by the "id" column (override with ExposeWithKey): GET /api/<table> -> {"rows":[[...],...]} (list) GET /api/<table>/count -> {"count":N} GET /api/<table>/<id> -> {"row":[...]} or 404 (read one) POST /api/<table> -> body "col=val&.." inserts; 201 PUT /api/<table>/<id> -> body "col=val&.." updates; {"updated":N} DELETE /api/<table>/<id> -> {"deleted":N} Values + the id are SQL-escaped (injection-safe).no extension
ExposeWithKey
Same, but with a custom primary-key column (e.g. "uuid", "rowid").no extension
RequireSignedRequests
NOTE (Haro aliasing): the stored signer is this server's COPY, so the replay-nonce ledger it maintains is the SERVER's. That is correct here -- signer and verifier are different roles, and in the real topology they are different processes sharing only the secret.QCSXTZZZIBWU
RequiresSignedRequests
request authentication (off-loopback listeners)no extension
MountAuth
HARO COPY SEMANTICS (read this): `=` and list insertion both COPY an object, so the server holds ITS OWN stzAuth. Configure and register BEFORE mounting. For a view shared with the caller (and durability), give the stzAuth a stzAuthDbStore: its sqlite is an engine handle, so the server's copy reads and writes the SAME database -- a login through HTTP is then visible to the caller's object, and vice versa.QCSXTZZZIBWU
MountAuthAt
user authentication router (stzauth)QCSXTZZZIBWU
AuthIsMounted
user authentication router (stzauth)no extension
AuthPrefix
user authentication router (stzauth)no extension
SetSecureCookies
Add Secure to the auth cookies -- TRUE whenever the listener is TLS, so the session cookie never travels in clear text.QCSXTZZZIBWU
SecureCookies
user authentication router (stzauth)no extension
MountOidcProvider
/authorize needs a signed-in user, and takes it from the SESSION COOKIE the mounted auth router issues -- so this server's own login becomes the login for every app that trusts it. With no session it answers 401 (the app in front redirects to its login page and comes back).QCSXTZZZIBWU
MountOidcProviderAt
oidc provider (this server as an idp)QCSXTZZZIBWU
OidcProviderIsMounted
oidc provider (this server as an idp)no extension
OidcProviderPrefix
oidc provider (this server as an idp)no extension
AuthWhy
Why the last request was refused ("" when none was).no extension
HostAgents
WHY EVERYTHING GOES THROUGH THE SERVER. Haro copies objects on `=`, so the host stored here is the server's own copy: a caller who kept the original would watch a snapshot that never ticks. That is why the supervision and read methods below DELEGATE instead of handing the host out -- the same cure stzAgentHost itself applies to its agents, and stzSuperApp to its governance. Reach the live host only through these.no extension
AdoptAgentHost
Adopt a host configured elsewhere (e.g. one carrying a decommission governance declared up front). It is REPARENTED onto this server's loop, and the caller's reference goes stale by the rule above.no extension
IsHostingAgents
(no comment in the source: the name reads as a sentence) is hosting agentsin the section agents: the agent host is the same hostno extension
SetAgentSlice
How long a single serve slice may park on the socket before due agents are ticked. Smaller = crisper agent timing, more loop turns.QCSXTZZZIBWU
AgentSlice
(no comment in the source: the name reads as a sentence) agent slicein the section agents: the agent host is the same hostno extension
SuperviseAgent
supervision, delegated to the live hostno extension
SuperviseAgentOnEvent
(no comment in the source: the name reads as a sentence) supervise agent on eventin the section agents: the agent host is the same hostno extension
NumberOfAgents
(no comment in the source: the name reads as a sentence) number of agentsin the section agents: the agent host is the same hostno extension
AgentNames
(no comment in the source: the name reads as a sentence) agent namesin the section agents: the agent host is the same hostno extension
AgentTicks
(no comment in the source: the name reads as a sentence) agent ticksin the section agents: the agent host is the same hostno extension
AgentIsActive
(no comment in the source: the name reads as a sentence) agent is activein the section agents: the agent host is the same hostno extension
AgentIsRetired
(no comment in the source: the name reads as a sentence) agent is retiredin the section agents: the agent host is the same hostno extension
AgentTrace
(no comment in the source: the name reads as a sentence) agent tracein the section agents: the agent host is the same hostno extension
PauseAgent
control. IN-PROCESS ONLY, deliberately (see _ServeAgents)no extension
ResumeAgent
(no comment in the source: the name reads as a sentence) resume agentin the section agents: the agent host is the same hostno extension
RetireAgent
Governed teardown: refused until the agent's declared obligations are fulfilled (R4b). Returns FALSE with AgentWhy() explaining the refusal.no extension
AgentWhy
(no comment in the source: the name reads as a sentence) agent whyin the section agents: the agent host is the same hostno extension
DeclareAgentDecommission
(no comment in the source: the name reads as a sentence) declare agent decommissionin the section agents: the agent host is the same hostno extension
FulfillAgentObligation
(no comment in the source: the name reads as a sentence) fulfill agent obligationin the section agents: the agent host is the same hostno extension
ListenRaw
A raw TCP listener (no HTTP framing): fHandler is called as call fHandler(oServer, nSid, nConn, cBytes) for every chunk a device sends; reply with RawWrite(). Requires a running server (the listener joins the same reactor).no extension
RawPort
iot: raw stream listenerno extension
RawWrite
iot: raw stream listenerno extension
ParseHttpRequest
Parse one complete HTTP/1.1 request (the engine frames it: full headers + Content-Length body, CRLF line endings).no extension