HttpRunner.ts
HttpRunner.ts overview
Section titled “HttpRunner.ts overview”Connects cluster runner RPCs to HTTP and WebSocket transports.
Runner nodes communicate through the Runners.Rpcs protocol. This module
provides client protocol layers for dialing runner addresses over HTTP or
WebSocket, HTTP effects that serve runner RPC handlers, route layers for
installing runner endpoints into an HttpRouter, and ready-made layers for
HTTP or WebSocket runner communication.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”http app
Section titled “http app”toHttpEffect
Section titled “toHttpEffect”Builds an HTTP effect that serves runner RPCs over the HTTP protocol.
Details
The returned effect is produced from RunnerServer.layerHandlers and the
cluster runner RPC group.
Signature
declare const toHttpEffect: Effect.Effect< Effect.Effect<HttpServerResponse, never, Scope | HttpServerRequest>, never, Scope | RpcSerialization.RpcSerialization | Sharding.Sharding | MessageStorage>Since v4.0.0
toHttpEffectWebsocket
Section titled “toHttpEffectWebsocket”Builds an HTTP effect that serves runner RPCs over WebSocket.
Details
The returned effect is produced from RunnerServer.layerHandlers and the
cluster runner RPC group.
Signature
declare const toHttpEffectWebsocket: Effect.Effect< Effect.Effect<HttpServerResponse, never, Scope | HttpServerRequest>, never, Scope | RpcSerialization.RpcSerialization | Sharding.Sharding | MessageStorage>Since v4.0.0
layers
Section titled “layers”layerClient
Section titled “layerClient”Layer that provides Sharding and Runners using the configured runner RPC
client protocol and storage services.
Signature
declare const layerClient: Layer.Layer< Sharding.Sharding | Runners.Runners, never, MessageStorage | RunnerStorage | ShardingConfig.ShardingConfig | Runners.RpcClientProtocol | RunnerHealth>Since v4.0.0
layerClientProtocolHttp
Section titled “layerClientProtocolHttp”Provides a runner RPC client protocol that connects to runner addresses over HTTP.
Details
The configured path is appended to each runner address, and https switches
the generated URL from http to https.
Signature
declare const layerClientProtocolHttp: (options: { readonly path: string readonly https?: boolean | undefined}) => Layer.Layer<RpcClientProtocol, never, RpcSerialization.RpcSerialization | HttpClient.HttpClient>Since v4.0.0
layerClientProtocolHttpDefault
Section titled “layerClientProtocolHttpDefault”Default HTTP runner client protocol layer using path /.
Signature
declare const layerClientProtocolHttpDefault: Layer.Layer< Runners.RpcClientProtocol, never, RpcSerialization.RpcSerialization | HttpClient.HttpClient>Since v4.0.0
layerClientProtocolWebsocket
Section titled “layerClientProtocolWebsocket”Provides a runner RPC client protocol that connects to runner addresses over WebSocket.
Details
The configured path is appended to each runner address, and https switches
the generated URL from ws to wss.
Signature
declare const layerClientProtocolWebsocket: (options: { readonly path: string readonly https?: boolean | undefined}) => Layer.Layer<RpcClientProtocol, never, RpcSerialization.RpcSerialization | Socket.WebSocketConstructor>Since v4.0.0
layerClientProtocolWebsocketDefault
Section titled “layerClientProtocolWebsocketDefault”Default WebSocket runner client protocol layer using path /.
Signature
declare const layerClientProtocolWebsocketDefault: Layer.Layer< Runners.RpcClientProtocol, never, Socket.WebSocketConstructor | RpcSerialization.RpcSerialization>Since v4.0.0
layerHttp
Section titled “layerHttp”Layer that serves runner routes at / and configures HTTP runner clients.
Details
It serves runner routes at / and configures runner clients to communicate
over HTTP.
Signature
declare const layerHttp: Layer.Layer< Sharding.Sharding | Runners.Runners, never, | RpcSerialization.RpcSerialization | HttpClient.HttpClient | HttpServer.HttpServer | MessageStorage | RunnerStorage | ShardingConfig.ShardingConfig | RunnerHealth>Since v4.0.0
layerHttpClientOnly
Section titled “layerHttpClientOnly”Provides a client-only HTTP runner layer.
When to use
Use to provide runner clients over HTTP from a process that should not serve runner routes.
Details
It configures runner clients to communicate over HTTP without serving runner HTTP routes.
Signature
declare const layerHttpClientOnly: Layer.Layer< Sharding.Sharding | Runners.Runners, never, | RpcSerialization.RpcSerialization | HttpClient.HttpClient | MessageStorage | RunnerStorage | ShardingConfig.ShardingConfig>Since v4.0.0
layerHttpOptions
Section titled “layerHttpOptions”Layer that adds HTTP runner routes to the provided HttpRouter.
Signature
declare const layerHttpOptions: (options: { readonly path: HttpRouter.PathInput}) => Layer.Layer< Sharding.Sharding | Runners.Runners, never, | RunnerStorage | RunnerHealth | RpcSerialization.RpcSerialization | MessageStorage | ShardingConfig.ShardingConfig | Runners.RpcClientProtocol | HttpRouter.HttpRouter>Since v4.0.0
layerWebsocket
Section titled “layerWebsocket”Layer that serves runner routes at / and configures WebSocket runner clients.
Details
It serves runner routes at / and configures runner clients to communicate
over WebSocket.
Signature
declare const layerWebsocket: Layer.Layer< Sharding.Sharding | Runners.Runners, never, | Socket.WebSocketConstructor | RpcSerialization.RpcSerialization | HttpServer.HttpServer | MessageStorage | RunnerStorage | ShardingConfig.ShardingConfig | RunnerHealth>Since v4.0.0
layerWebsocketClientOnly
Section titled “layerWebsocketClientOnly”Provides a client-only WebSocket runner layer.
When to use
Use to provide runner clients over WebSocket from a process that should not serve runner routes.
Details
It configures runner clients to communicate over WebSocket without serving runner WebSocket routes.
Signature
declare const layerWebsocketClientOnly: Layer.Layer< Sharding.Sharding | Runners.Runners, never, | Socket.WebSocketConstructor | RpcSerialization.RpcSerialization | MessageStorage | RunnerStorage | ShardingConfig.ShardingConfig>Since v4.0.0
layerWebsocketOptions
Section titled “layerWebsocketOptions”Layer that adds WebSocket runner routes to the provided HttpRouter.
Signature
declare const layerWebsocketOptions: (options: { readonly path: HttpRouter.PathInput}) => Layer.Layer< Sharding.Sharding | Runners.Runners, never, | ShardingConfig.ShardingConfig | Runners.RpcClientProtocol | MessageStorage | RunnerStorage | RunnerHealth | RpcSerialization.RpcSerialization | HttpRouter.HttpRouter>Since v4.0.0