Server
Entry points
run() and stop() knows no protocol in particular — they take already-constructed servers and
drive their lifecycle. Use them when you build servers yourself; Thing.run(access_points=...) is
the shorthand that calls run().
hololinked.server.run
run(*servers: BaseProtocolServer, forked: bool = False, print_welcome_message: bool = True, id: str | None = None) -> None
Run servers and serve your things.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BaseProtocolServer
|
one or more server instances to run |
()
|
|
bool
|
whether to run in a forked thread |
False
|
|
bool
|
whether to print a welcome message on startup, like the ports and access points |
True
|
|
str | None
|
name this run, so that a |
None
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
if a server cannot start - each protocol decides what it needs |
ValueError
|
if the run ID is reused by another active run |
Source code in repo/hololinked/hololinked/server/server.py
hololinked.server.stop
Shutdown the servers started by run().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str | None
|
the id given to |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
if no id is given while more than one run is serving |
Source code in repo/hololinked/hololinked/server/server.py
hololinked.server.parse_params
parse_params(id: str, access_points: list[tuple[str, str | int | dict | list[str]]]) -> list[BaseProtocolServer]
Create one protocol server per requested access point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
identifier given to the servers that need one for routing, currently only ZMQ |
required |
|
list[tuple[str, str | int | dict | list[str]]]
|
one tuple per protocol - |
required |
Returns:
| Type | Description |
|---|---|
list[BaseProtocolServer]
|
the created servers, in the order their access points were given |
Raises:
| Type | Description |
|---|---|
TypeError
|
if |
ValueError
|
if the parameters given for a protocol are not of a supported type |