ProtocolServer
Namespace: E2E.Engine.Protocol
public static class ProtocolServerThe server half of the engine protocol: ServeEngineAsync answers the protocol with an engine
built by DefineEngine(EngineSpec), so any engine written in .NET can run in a process of its own. An engine in another
language implements the same messages; this file is their reference implementation. Upstream’s engine/protocol/server.ts.
Inheritance: object
.NET-only holder name: C# has no free functions.
Methods
Section titled “Methods”ServeEngineAsync(EngineHandle, MessageStreams?)
Section titled “ServeEngineAsync(EngineHandle, MessageStreams?)”public static Task ServeEngineAsync(EngineHandle engine, MessageStreams? streams = null)Serves <code class=“paramref”>engine</code> over one connection until the client sends exit or the streams close. Completes once the
connection is closed; a server process then exits. Defaults to the process’s stdin and stdout, the transport a client’s
SpawnTransport opens: keep the engine’s own logging on stderr. Upstream’s serveEngine.
Parameters
| Name | Type | Description |
|---|---|---|
engine |
EngineHandle | |
streams |
MessageStreams |
Returns: Task
ServeEngineAsync(Func<JsonNode?, Task<EngineHandle>>, MessageStreams?)
Section titled “ServeEngineAsync(Func<JsonNode?, Task<EngineHandle>>, MessageStreams?)”public static Task ServeEngineAsync(Func<JsonNode?, Task<EngineHandle>> factory, MessageStreams? streams = null)ServeEngineAsync with a factory that builds the engine from the client’s
initializationOptions.
Parameters
| Name | Type | Description |
|---|---|---|
factory |
Func<JsonNode, Task<EngineHandle>> | |
streams |
MessageStreams |
Returns: Task