nats-rpc/elm-nrpc/1.0.0

Nrpc

Utilities for Nrpc generated code

type Error
= Timeout
| DecodeError String
| ClientError String
| ServerError String
| ServerTooBusy String
| EOS Int

Nrpc error type

(arg -> Encoder)
-> Decoder result
-> String
-> arg
-> (Result Error result -> msg)
-> Effect Bytes msg

Perform a request

(arg -> Encoder)
-> String
-> arg
-> (Result Error () -> msg)
-> Effect Bytes msg

Perform a request to a method with void

requestNoReply : (arg -> Encoder) -> String -> arg -> Effect Bytes msg

publish a message to a 'noreply' method

See https://github.com/nats-rpc/nrpc/wiki/Specifications#noreply

subscribeToNoRequestMethod : String -> Decoder a -> (Result Error a -> msg) -> Sub Bytes msg

subscribe to a NoRequest method

(arg -> Encoder)
-> Decoder result
-> String
-> arg
-> (Result Error result -> msg)
-> Effect Bytes msg

Perform a request expecting a streamed reply

See https://github.com/nats-rpc/nrpc/wiki/Specifications#streamed-replies

cancelStreamRequest : String -> Effect datatype msg

Cancel a stream request given its marker

The given marker must not have the "stream/" prefix

heartbeat : State Bytes msg -> Effect Bytes msg

Send a heartbeat in all the streamed requests. Should be done every seconds or so

setStreamRequestMarker : String -> Effect datatype msg -> Effect datatype msg

Add a marker to a streamRequest

The string "stream/" will be prepended to the marker, so the heartbeat mechanism can still operate.

The "stream/" prefix must be added too for tracking the request with Nats.track.

{ sid : String
, id : String
, marker : Maybe String
, subject : String
, inbox : String
}
-> Effect Bytes msg

Returns a nats effect to apply when a request is canceled.

It sends the 'lastbeat' message on stream requests