RpcServer
Constructors
toWebHandler
Construct an http web handler from an RpcGroup.
Signature
declare function toWebHandler<Rpcs extends Any, LE>(group: RpcGroup<Rpcs>, options: { readonly disableFatalDefects?: boolean; readonly disableTracing?: boolean; readonly layer: Layer<any, LE>; readonly memoMap?: MemoMap; readonly middleware?: (httpApp: Default) => Default<never, DefaultServices>; readonly spanAttributes?: Record<string, unknown>; readonly spanPrefix?: string;}): { readonly dispose: () => Promise<void>; readonly handler: (request: Request, context?: Context<never>) => Promise<Response>;}Http App
Signature
declare const toHttpApp: <Rpcs extends Rpc.Any>(group: RpcGroup.RpcGroup<Rpcs>, options?: { readonly disableFatalDefects?: boolean; readonly disableTracing?: boolean; readonly spanAttributes?: Record<string, unknown>; readonly spanPrefix?: string;}) => Effect.Effect<HttpApp.Default<never, Scope.Scope>, never, Scope.Scope | RpcSerialization.RpcSerialization | Rpc.ToHandler<Rpcs> | Rpc.Context<Rpcs> | Rpc.Middleware<Rpcs>>toHttpAppWebsocket
Signature
declare const toHttpAppWebsocket: <Rpcs extends Rpc.Any>(group: RpcGroup.RpcGroup<Rpcs>, options?: { readonly disableFatalDefects?: boolean; readonly disableTracing?: boolean; readonly spanAttributes?: Record<string, unknown>; readonly spanPrefix?: string;}) => Effect.Effect<HttpApp.Default<never, Scope.Scope>, never, Scope.Scope | RpcSerialization.RpcSerialization | Rpc.ToHandler<Rpcs> | Rpc.Context<Rpcs> | Rpc.Middleware<Rpcs>>Interruption
fiberIdClientInterrupt
Fiber id used for client interruptions.
Signature
declare const fiberIdClientInterrupt: RuntimefiberIdTransientInterrupt
Fiber id used for transient interruptions.
Signature
declare const fiberIdTransientInterrupt: RuntimeProtocol
layerHttpRouter
Create a RPC server that registers a HTTP route with a HttpLayerRouter.
It defaults to using websockets for communication, but can be configured to use HTTP.
Signature
declare function layerHttpRouter<Rpcs extends Any>(options: { readonly concurrency?: number | "unbounded"; readonly disableFatalDefects?: boolean; readonly disableTracing?: boolean; readonly group: RpcGroup<Rpcs>; readonly path: PathInput; readonly protocol?: "http" | "websocket"; readonly spanAttributes?: Record<string, unknown>; readonly spanPrefix?: string;}): Layer<never, never, any>layerProtocolHttp
A rpc protocol that uses streaming http for communication.
Signature
declare function layerProtocolHttp<I = Default>(options: { readonly path: PathInput; readonly routerTag?: any;}): Layer<Protocol, never, RpcSerialization>layerProtocolHttpRouter
A rpc protocol that uses streaming http for communication.
Uses a HttpLayerRouter to provide the http endpoint.
Signature
declare function layerProtocolHttpRouter(options: { readonly path: PathInput;}): Layer<Protocol, never, any>layerProtocolSocketServer
A rpc protocol that uses SocketServer for communication.
Signature
declare const layerProtocolSocketServer: Layer.Layer<Protocol, never, RpcSerialization.RpcSerialization | SocketServer.SocketServer>layerProtocolStdio
Create a protocol that uses the provided Stream and Sink for communication.
Signature
declare function layerProtocolStdio<EIn, EOut, RIn, ROut>(options: { readonly stdin: Stream<Uint8Array<ArrayBufferLike>, EIn, RIn>; readonly stdout: Sink<void, string | Uint8Array<ArrayBufferLike>, unknown, EOut, ROut>;}): Layer<Protocol, never, RpcSerialization | RIn | ROut>layerProtocolWebsocket
A rpc protocol that uses websockets for communication.
Signature
declare function layerProtocolWebsocket<I = Default>(options: { readonly path: PathInput; readonly routerTag?: any;}): Layer<Protocol, never, RpcSerialization>layerProtocolWebsocketRouter
A rpc protocol that uses websockets for communication.
Uses a HttpLayerRouter to provide the websocket endpoint.
Signature
declare function layerProtocolWebsocketRouter(options: { readonly path: PathInput;}): Layer<Protocol, never, any>layerProtocolWorkerRunner
Signature
declare const layerProtocolWorkerRunner: Layer.Layer<Protocol, WorkerError, WorkerRunner.PlatformRunner>makeProtocolHttp
Signature
declare const makeProtocolHttp: <I = Default>(...args: [options: { readonly path: PathInput; readonly routerTag?: any;}]) => Effect<any, unknown, unknown>makeProtocolHttpRouter
Signature
declare const makeProtocolHttpRouter: (...args: [options: { readonly path: PathInput;}]) => Effect<any, unknown, unknown>makeProtocolSocketServer
Signature
declare const makeProtocolSocketServer: Effect<any, unknown, unknown>makeProtocolStdio
Create a protocol that uses the provided Stream and Sink for communication.
Signature
declare const makeProtocolStdio: <EIn, EOut, RIn, ROut>(...args: [options: { readonly stdin: Stream<Uint8Array<ArrayBufferLike>, EIn, RIn>; readonly stdout: Sink<void, string | Uint8Array<ArrayBufferLike>, unknown, EOut, ROut>;}]) => Effect<any, unknown, unknown>makeProtocolWebsocket
Signature
declare const makeProtocolWebsocket: <I = HttpRouter.Default>(options: { readonly path: HttpRouter.PathInput; readonly routerTag?: Context.Tag<I, HttpRouter.HttpRouter.Service<any, any>>;}) => Effect.Effect<Protocol["Type"], never, RpcSerialization.RpcSerialization | I>makeProtocolWebsocketRouter
Signature
declare const makeProtocolWebsocketRouter: (options: { readonly path: HttpRouter.PathInput;}) => Effect.Effect<Protocol["Type"], never, RpcSerialization.RpcSerialization | HttpLayerRouter.HttpRouter>makeProtocolWithHttpApp
Signature
declare const makeProtocolWithHttpApp: Effect.Effect<{ readonly httpApp: HttpApp.Default<never, Scope.Scope>; readonly protocol: Protocol["Type"];}, never, RpcSerialization.RpcSerialization>makeProtocolWithHttpAppWebsocket
Signature
declare const makeProtocolWithHttpAppWebsocket: Effect.Effect<{ readonly httpApp: HttpApp.Default<never, Scope.Scope>; readonly protocol: Protocol["Type"];}, never, RpcSerialization.RpcSerialization>makeProtocolWorkerRunner
Signature
declare const makeProtocolWorkerRunner: Effect.Effect<Protocol["Type"], WorkerError, WorkerRunner.PlatformRunner | Scope.Scope>Signature
declare class Protocol extends any { constructor(); static make: <EX, RX>(f: (write: any) => Effect<Omit<any, "run">, EX, RX>) => Effect<any, EX, RX>;}Server
Signature
declare function layer<Rpcs extends Any>(group: RpcGroup<Rpcs>, options?: { readonly concurrency?: number | "unbounded"; readonly disableFatalDefects?: boolean; readonly disableTracing?: boolean; readonly spanAttributes?: Record<string, unknown>; readonly spanPrefix?: string;}): Layer<never, never, Protocol | ToHandler<Rpcs> | Context<Rpcs> | Middleware<Rpcs>>Signature
declare const make: <Rpcs extends Rpc.Any>(group: RpcGroup.RpcGroup<Rpcs>, options?: { readonly concurrency?: number | "unbounded"; readonly disableFatalDefects?: boolean; readonly disableTracing?: boolean; readonly spanAttributes?: Record<string, unknown>; readonly spanPrefix?: string;}) => Effect.Effect<never, never, Protocol | Rpc.ToHandler<Rpcs> | Rpc.Middleware<Rpcs> | Rpc.Context<Rpcs>>makeNoSerialization
Signature
declare const makeNoSerialization: <Rpcs extends Rpc.Any>(group: RpcGroup.RpcGroup<Rpcs>, options: { readonly concurrency?: number | "unbounded"; readonly disableClientAcks?: boolean; readonly disableFatalDefects?: boolean; readonly disableSpanPropagation?: boolean; readonly disableTracing?: boolean; readonly onFromServer: (response: FromServer<Rpcs>) => Effect.Effect<void>; readonly spanAttributes?: Record<string, unknown>; readonly spanPrefix?: string;}) => Effect.Effect<RpcServer<Rpcs>, never, Rpc.ToHandler<Rpcs> | Rpc.Middleware<Rpcs> | Scope.Scope>Signature
interface RpcServer<A extends Rpc.Any> { readonly disconnect: (clientId: number) => Effect<void>; readonly write: (clientId: number, message: FromClient<A>) => Effect<void>;}