Starting work on the JSON-RPC client in the web server. The `Context` structure, which is stored in Rocket's managed state and available to route functions through the `State` request guard, provides a method to get an RPC client. Each request that needs to communicate with the daemon will have its own RPC connection. This ensures that a valid connection is always available, even if the daemon has restarted between web requests. I had considered storing the connection in the context, testing it each time it was needed, and reconnecting if the connection was broken. This proved very difficult, since the context is passed to request handlers as an immutable reference. Mutating its state would require locking, and I could not make that work easily. Besides, the overhead of "pinging" the server for every request is probably greater than just reconnecting every time, so it would have been a waste. The *GET /status* operation returns a document that indicates the status of the daemon and the web server. |
||
---|---|---|
backend | ||
ui | ||
weywot.code-workspace |