Implement a Websocket interface that allows to control strawman remotely
grebaldi opened this issue · comments
It should be possible to remote control a strawman-server instance.
To achieve this, a websocket interface is to be implemented in the scope of this issue.
This interface should allow for calling application services of strawman-core
and to exchange log messages coming from the strawman-server instance.
It should follow the JSON-RPC Protocol (version 2.0).
It should live in modules/strawman-server-rc
and be invoked as in both the capture
and the replay
command of strawman-server-cli
.
Regarding log message exchange:
Currently, log messages are simply being written via console.log
or similar methods. In the scope of this issue, logging should be moved to a dedicated event bus.
To achieve the exchange, strawman-server-rc
should treat all its clients as JSON-RPC-servers themselves to allow for duplex communication.
Further resources:
Edit 2022-01-27 13:53:
It turns out, this feature is quite difficult to unravel from the current state of affairs. After some investigation and one failed attempt to approach this problem, I identified the following TODOs:
- Introduce a
Mode
concept to the domain layer ofstrawman-core
- This will provide a strategy-like approach to the distinction between the
replay
andcapture
functionalities
- This will provide a strategy-like approach to the distinction between the
- Merge the
captureRequest
andreplayRequest
application services into a singlehandleHttpRequest
service- This service will use the
Mode
concept to decide whether to capture or to replay the request
- This service will use the
- Implement an event-bus-driven logger.
- This should probably go into a separate module
- It should also cover the existing
logError
function
- Implement the rc server
- Merge the
capture
andreplay
commands ofstrawman-cli-server
into a singlestart
command- This command will start both the http and the rc server