docs: Update server architecture documentation

This commit is contained in:
Joachim Van Herwegen 2024-07-01 09:28:48 +02:00
parent 73619fda05
commit 9c44f375f2

View File

@ -108,32 +108,33 @@ to add any custom initializers that need to run.
The `ServerInitializer` is the initializer that finally starts up the server by listening to the relevant port, The `ServerInitializer` is the initializer that finally starts up the server by listening to the relevant port,
once all the initialization described above is finished. once all the initialization described above is finished.
It takes as input 2 components: a `HttpServerFactory` and a `ServerListener`. To do this it makes use of an `HttpServerFactory`.
```mermaid ```mermaid
flowchart TD flowchart TD
ServerInitializer("<strong>ServerInitializer</strong><br>ServerInitializer") ServerInitializer("<strong>ServerInitializer</strong><br>ServerInitializer")
ServerInitializer --> ServerInitializerArgs ServerInitializer --> ServerFactory("<strong>ServerFactory</strong><br>BaseServerFactory")
ServerFactory --> ServerConfigurator("<strong>ServerConfigurator</strong><br>ParallelHandler")
ServerConfigurator --> ServerConfiguratorArgs
subgraph ServerInitializerArgs[" "] subgraph ServerConfiguratorArgs[" "]
direction LR direction LR
ServerFactory("<strong>ServerFactory</strong><br>BaseServerFactory") HandlerServerConfigurator("<strong>HandlerServerConfigurator</strong><br>HandlerServerConfigurator")
ServerListener("<strong>ServerListener</strong><br>ParallelHandler") WebSocketServerConfigurator("<strong>WebSocketServerConfigurator</strong><br>WebSocketServerConfigurator")
end end
ServerListener --> HandlerServerListener("<strong>HandlerServerListener</strong><br>HandlerServerListener") HandlerServerConfigurator --> HttpHandler("<strong>HttpHandler</strong><br><i>HttpHandler</i>")
WebSocketServerConfigurator --> WebSocketHandler("<strong>WebSocketHandler</strong><br><i>WebSocketHandler</i>")
HandlerServerListener --> HttpHandler("<strong>HttpHandler</strong><br><i>HttpHandler</i>")
``` ```
The `HttpServerFactory` is responsible for starting a server on a given port. The `HttpServerFactory` is responsible for starting a server on a given port.
Depending on the configuration this can be an HTTP or an HTTPS server. Depending on the configuration this can be an HTTP or an HTTPS server.
The created server emits events when it receives requests. The created server emits events when it receives requests.
A `ServerListener` is a class that takes the created server as input and attaches a listener to interpret events. Any requests it receives, it sends to its `ServerConfigurator`,
One listener that is always used is the `urn:solid-server:default:HandlerServerListener`, which handles the request as needed.
which calls an `HttpHandler` [to resolve HTTP requests](http-handler.md). This is a `ParallelHandler`, supporting two kinds of requests:
HTTP requests go through a configurator that sends those
Sometimes it is necessary to add additional listeners, to an `HttpHandler` [to resolve HTTP requests](http-handler.md).
these can then be added to the `urn:solid-server:default:ServerListener` as it is a `ParallellHandler`. In case WebSockets are enabled [to handle notifications](notifications.md),
An example of this is when WebSockets are used [to handle notifications](notifications.md). these are handled by the `WebSocketHandler`.