effect-rpc
    Preparing search index...

    Function createRuntime

    • Creates a Effect Runtime for RPC communication with a specified URL and optional serialization. This function is useful for setting up a runtime environment without sticking it together with all the other parts. It's a convenience function over createEffectRPC and getServerLayers and potentially others.

      You can give it any additional layers that the runtime should have.

      Type Parameters

      • R
      • E

      Parameters

      • config: {
            additionalLayers?: Layer<R, E, never>[];
            serialization?: SerializationLayer;
            url: string;
        }

        Configuration object for the RPC runtime.

        • OptionaladditionalLayers?: Layer<R, E, never>[]

          (Optional) Additional layers to merge with the RPC client layer.

        • Optionalserialization?: SerializationLayer

          (Optional) Custom serialization layer to use for RPC communication of type SerializationLayer. Defaults to RpcSerialization.layerNdjson.

        • url: string

          The base URL of the RPC server.

      Returns ManagedRuntime<Protocol | R, E>

      const runtime = createRuntime({
      url: "https://my-rpc-server.com",
      serialization: MyCustomSerializationLayer,
      additionalLayers: [MyCustomLayer]
      });

      0.7.0