orus-io / elm-nats / Nats.Config

Define the configuration for NATS

bytes : (Nats.Msg Bytes msg -> msg) -> Nats.PortsAPI.Ports String (Nats.Msg Bytes msg) -> Nats.Config Bytes String msg

Create a NATS configuration for bytes messages

The binary contents will be base64 encoded/decoded for passing through the ports

bytesPorts : (Nats.Msg Bytes msg -> msg) -> Nats.PortsAPI.Ports Bytes (Nats.Msg Bytes msg) -> Nats.Config Bytes Bytes msg

Create a NATS configuration for bytes messages through ports supporting the Bytes type.

The binary contents will be passed as is through the ports. Currently the only known compiler supporting this is the Lamdera compiler, which requires the dependency "lamdera/codecs" to be added to your project.

string : (Nats.Msg String msg -> msg) -> Nats.PortsAPI.Ports String (Nats.Msg String msg) -> Nats.Config String String msg

Create a NATS configuration for string messages

The parentMsg typically transform a Nats.Msg into the host application top-level message.

type Msg =
    NatsMsg (Nats.Msg Msg)
    | ...

natsConfig =
    Nats.Config.init NatsMsg {}

withDebug : Basics.Bool -> Nats.Config datatype portdatatype msg -> Nats.Config datatype portdatatype msg

Enable debug