<Serve extends Layer.Layer<never, any, any>>(
serve: Serve,
options?: HttpServerOptions
): Layer.Layer<
Layer.Success<Serve>,
Layer.Error<Serve>,
Layer.Services<Serve> | HttpServer.HttpServer
>
(options?: HttpServerOptions): Layer.Layer<
never,
never,
Hyperlink.ServedHyperlinks | HttpServer.HttpServer
>
<Serves extends ServerServeList>(
serves: Serves,
options?: HttpServerOptions
): Layer.Layer<
Layer.Success<Serves[number]>,
Layer.Error<Serves[number]>,
Layer.Services<Serves[number]> | HttpServer.HttpServer
>A WebSocket RPC server — the httpServer sibling for the browser. Everything a client
subscribes to (each resource's status + metrics + logs) rides one multiplexed WebSocket per
client, so a dashboard never trips the browser's ~6-connection-per-origin HTTP/1.1 cap that
starves streams over plain HTTP. Identical to httpServer in every other way — same serve
list, same options, same /health — it just speaks WebSocket instead of HTTP POST. Clients connect
with Hyperlink.ws (or Hyperlink.layerProtocol(Hyperlink.protocolWebsocket())); a fleet whose
peers also serve over this should add Hyperlink.layerPeerProtocol(Hyperlink.protocolWebsocket).
const Node = Hyperlink.wsServer([Hyperlink.serve(Jobs, jobsImpl)]).pipe(
Layer.provide(NodeHttpServer.layer(() => createServer(), { port })),
);export function function wsServer<Serve extends Layer.Layer<never, any, any>>(serve: Serve, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serve>, Layer.Error<Serve>, Layer.Services<Serve> | HttpServer.HttpServer> (+2 overloads)A WebSocket RPC server — the
httpServer
sibling for the browser. Everything a client
subscribes to (each resource's status + metrics + logs) rides one multiplexed WebSocket per
client, so a dashboard never trips the browser's ~6-connection-per-origin HTTP/1.1 cap that
starves streams over plain HTTP. Identical to
httpServer
in every other way — same serve
list, same options, same /health — it just speaks WebSocket instead of HTTP POST. Clients connect
with
Hyperlink.ws
(or Hyperlink.layerProtocol(Hyperlink.protocolWebsocket())); a fleet whose
peers also serve over this should add Hyperlink.layerPeerProtocol(Hyperlink.protocolWebsocket).
const Node = Hyperlink.wsServer([Hyperlink.serve(Jobs, jobsImpl)]).pipe(
Layer.provide(NodeHttpServer.layer(() => createServer(), { port })),
);
wsServer<function (type parameter) Serve in wsServer<Serve extends Layer.Layer<never, any, any>>(serve: Serve, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serve>, Layer.Error<Serve>, Layer.Services<Serve> | HttpServer.HttpServer>Serve extends import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<never, any, any>>(
serve: Serve extends Layer.Layer<never, any, any>serve: function (type parameter) Serve in wsServer<Serve extends Layer.Layer<never, any, any>>(serve: Serve, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serve>, Layer.Error<Serve>, Layer.Services<Serve> | HttpServer.HttpServer>Serve,
options: HttpServerOptionsoptions?: HttpServerOptions,
): import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<
import LayerLayer.type Success<T extends Layer.Any> =
T extends Layer.Layer<
infer _ROut,
infer _E,
infer _RIn
>
? _ROut
: never
Extracts the service output type (ROut) from a Layer type.
When to use
Use to derive the services provided by an existing or generic Layer without
restating its ROut type parameter.
Success<function (type parameter) Serve in wsServer<Serve extends Layer.Layer<never, any, any>>(serve: Serve, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serve>, Layer.Error<Serve>, Layer.Services<Serve> | HttpServer.HttpServer>Serve>,
import LayerLayer.type Error<T extends Layer.Any> =
T extends Layer.Layer<
infer _ROut,
infer _E,
infer _RIn
>
? _E
: never
Extracts the error type (E) from a Layer type.
When to use
Use to derive a layer construction error type for helper types, wrappers, or
APIs that preserve a layer failure channel.
Error<function (type parameter) Serve in wsServer<Serve extends Layer.Layer<never, any, any>>(serve: Serve, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serve>, Layer.Error<Serve>, Layer.Services<Serve> | HttpServer.HttpServer>Serve>,
import LayerLayer.type Services<T extends Layer.Any> =
T extends infer L
? L extends Layer.Layer<
infer _ROut,
infer _E,
infer _RIn
>
? _RIn
: never
: never
Extracts the service requirements (RIn) from a Layer type.
When to use
Use to derive the dependency requirements of a generic or inferred Layer
without restating its RIn type parameter.
Services<function (type parameter) Serve in wsServer<Serve extends Layer.Layer<never, any, any>>(serve: Serve, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serve>, Layer.Error<Serve>, Layer.Services<Serve> | HttpServer.HttpServer>Serve> | import HttpServerHttpServer.class HttpServerclass HttpServer {
key: Identifier;
Service: {
serve: { <E, R>(effect: Effect.Effect<HttpServerResponse, E, R>): Effect.Effect<void, never, Exclude<R, HttpServerRequest> | Scope.Scope>; <E, R, App extends Effect.Effect<HttpServerResponse, any, any>>(effect: Effect.Effect<HttpServerResponse, E…;
address: Address;
};
}
Service tag for an HTTP server runtime.
Details
The service can serve an HTTP response effect and exposes the address where the
server is listening.
HttpServer
>;
export function function wsServer(options?: HttpServerOptions): Layer.Layer<never, never, Hyperlink.ServedHyperlinks | HttpServer.HttpServer> (+2 overloads)A WebSocket RPC server — the
httpServer
sibling for the browser. Everything a client
subscribes to (each resource's status + metrics + logs) rides one multiplexed WebSocket per
client, so a dashboard never trips the browser's ~6-connection-per-origin HTTP/1.1 cap that
starves streams over plain HTTP. Identical to
httpServer
in every other way — same serve
list, same options, same /health — it just speaks WebSocket instead of HTTP POST. Clients connect
with
Hyperlink.ws
(or Hyperlink.layerProtocol(Hyperlink.protocolWebsocket())); a fleet whose
peers also serve over this should add Hyperlink.layerPeerProtocol(Hyperlink.protocolWebsocket).
const Node = Hyperlink.wsServer([Hyperlink.serve(Jobs, jobsImpl)]).pipe(
Layer.provide(NodeHttpServer.layer(() => createServer(), { port })),
);
wsServer(
options: HttpServerOptionsoptions?: HttpServerOptions,
): import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<never, never, import HyperlinkHyperlink.type Hyperlink.ServedHyperlinks = /*unresolved*/ anyServedHyperlinks | import HttpServerHttpServer.class HttpServerclass HttpServer {
key: Identifier;
Service: {
serve: { <E, R>(effect: Effect.Effect<HttpServerResponse, E, R>): Effect.Effect<void, never, Exclude<R, HttpServerRequest> | Scope.Scope>; <E, R, App extends Effect.Effect<HttpServerResponse, any, any>>(effect: Effect.Effect<HttpServerResponse, E…;
address: Address;
};
}
Service tag for an HTTP server runtime.
Details
The service can serve an HTTP response effect and exposes the address where the
server is listening.
HttpServer>;
export function function wsServer<Serves extends ServerServeList>(serves: Serves, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serves[number]>, Layer.Error<Serves[number]>, Layer.Services<Serves[number]> | HttpServer.HttpServer> (+2 overloads)A WebSocket RPC server — the
httpServer
sibling for the browser. Everything a client
subscribes to (each resource's status + metrics + logs) rides one multiplexed WebSocket per
client, so a dashboard never trips the browser's ~6-connection-per-origin HTTP/1.1 cap that
starves streams over plain HTTP. Identical to
httpServer
in every other way — same serve
list, same options, same /health — it just speaks WebSocket instead of HTTP POST. Clients connect
with
Hyperlink.ws
(or Hyperlink.layerProtocol(Hyperlink.protocolWebsocket())); a fleet whose
peers also serve over this should add Hyperlink.layerPeerProtocol(Hyperlink.protocolWebsocket).
const Node = Hyperlink.wsServer([Hyperlink.serve(Jobs, jobsImpl)]).pipe(
Layer.provide(NodeHttpServer.layer(() => createServer(), { port })),
);
wsServer<function (type parameter) Serves in wsServer<Serves extends ServerServeList>(serves: Serves, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serves[number]>, Layer.Error<Serves[number]>, Layer.Services<Serves[number]> | HttpServer.HttpServer>Serves extends import ServerServeListServerServeList>(
serves: Serves extends ServerServeListserves: function (type parameter) Serves in wsServer<Serves extends ServerServeList>(serves: Serves, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serves[number]>, Layer.Error<Serves[number]>, Layer.Services<Serves[number]> | HttpServer.HttpServer>Serves,
options: HttpServerOptionsoptions?: HttpServerOptions,
): import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<
import LayerLayer.type Success<T extends Layer.Any> =
T extends Layer.Layer<
infer _ROut,
infer _E,
infer _RIn
>
? _ROut
: never
Extracts the service output type (ROut) from a Layer type.
When to use
Use to derive the services provided by an existing or generic Layer without
restating its ROut type parameter.
Success<function (type parameter) Serves in wsServer<Serves extends ServerServeList>(serves: Serves, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serves[number]>, Layer.Error<Serves[number]>, Layer.Services<Serves[number]> | HttpServer.HttpServer>Serves[number]>,
import LayerLayer.type Error<T extends Layer.Any> =
T extends Layer.Layer<
infer _ROut,
infer _E,
infer _RIn
>
? _E
: never
Extracts the error type (E) from a Layer type.
When to use
Use to derive a layer construction error type for helper types, wrappers, or
APIs that preserve a layer failure channel.
Error<function (type parameter) Serves in wsServer<Serves extends ServerServeList>(serves: Serves, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serves[number]>, Layer.Error<Serves[number]>, Layer.Services<Serves[number]> | HttpServer.HttpServer>Serves[number]>,
import LayerLayer.type Services<T extends Layer.Any> =
T extends infer L
? L extends Layer.Layer<
infer _ROut,
infer _E,
infer _RIn
>
? _RIn
: never
: never
Extracts the service requirements (RIn) from a Layer type.
When to use
Use to derive the dependency requirements of a generic or inferred Layer
without restating its RIn type parameter.
Services<function (type parameter) Serves in wsServer<Serves extends ServerServeList>(serves: Serves, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serves[number]>, Layer.Error<Serves[number]>, Layer.Services<Serves[number]> | HttpServer.HttpServer>Serves[number]> | import HttpServerHttpServer.class HttpServerclass HttpServer {
key: Identifier;
Service: {
serve: { <E, R>(effect: Effect.Effect<HttpServerResponse, E, R>): Effect.Effect<void, never, Exclude<R, HttpServerRequest> | Scope.Scope>; <E, R, App extends Effect.Effect<HttpServerResponse, any, any>>(effect: Effect.Effect<HttpServerResponse, E…;
address: Address;
};
}
Service tag for an HTTP server runtime.
Details
The service can serve an HTTP response effect and exposes the address where the
server is listening.
HttpServer
>;
export function function wsServer<Serve extends Layer.Layer<never, any, any>>(serve: Serve, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serve>, Layer.Error<Serve>, Layer.Services<Serve> | HttpServer.HttpServer> (+2 overloads)A WebSocket RPC server — the
httpServer
sibling for the browser. Everything a client
subscribes to (each resource's status + metrics + logs) rides one multiplexed WebSocket per
client, so a dashboard never trips the browser's ~6-connection-per-origin HTTP/1.1 cap that
starves streams over plain HTTP. Identical to
httpServer
in every other way — same serve
list, same options, same /health — it just speaks WebSocket instead of HTTP POST. Clients connect
with
Hyperlink.ws
(or Hyperlink.layerProtocol(Hyperlink.protocolWebsocket())); a fleet whose
peers also serve over this should add Hyperlink.layerPeerProtocol(Hyperlink.protocolWebsocket).
const Node = Hyperlink.wsServer([Hyperlink.serve(Jobs, jobsImpl)]).pipe(
Layer.provide(NodeHttpServer.layer(() => createServer(), { port })),
);
wsServer(
servesOrOptions: | Layer.Layer<never, any, any>
| ServerServeList
| ReadonlyArray<Layer.Layer<never, any, any>>
| HttpServerOptions
servesOrOptions?:
| import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<never, any, any>
| import ServerServeListServerServeList
| interface ReadonlyArray<T>ReadonlyArray<import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<never, any, any>>
| HttpServerOptions,
maybeOptions: HttpServerOptionsmaybeOptions?: HttpServerOptions,
): import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<never, any, any> {
return function serverImpl(
serverProtocol: ServerProtocol,
serverKind: ProtocolKind,
servesOrOptions?:
| Layer.Layer<never, any, any>
| ServerServeList
| ReadonlyArray<Layer.Layer<never, any, any>>
| HttpServerOptions,
maybeOptions?: HttpServerOptions
): Layer.Layer<never, any, any>
serverImpl(
import HyperlinkHyperlink.serverProtocolWebsocket,
"WebSocket",
servesOrOptions: | Layer.Layer<never, any, any>
| ServerServeList
| ReadonlyArray<Layer.Layer<never, any, any>>
| HttpServerOptions
servesOrOptions,
maybeOptions: HttpServerOptionsmaybeOptions,
);
}