Utilities for Nrpc generated code
Nrpc error type
request : (arg -> Protobuf.Encode.Encoder) -> Protobuf.Decode.Decoder result -> String -> arg -> (Result Error result -> msg) -> Nats.Effect Bytes msg
Perform a request
requestVoidReply : (arg -> Protobuf.Encode.Encoder) -> String -> arg -> (Result Error () -> msg) -> Nats.Effect Bytes msg
Perform a request to a method with void
requestNoReply : (arg -> Protobuf.Encode.Encoder) -> String -> arg -> Nats.Effect Bytes msg
publish a message to a 'noreply' method
See https://github.com/nats-rpc/nrpc/wiki/Specifications#noreply
subscribeToNoRequestMethod : String -> Protobuf.Decode.Decoder a -> (Result Error a -> msg) -> Nats.Sub Bytes msg
subscribe to a NoRequest method
streamRequest : (arg -> Protobuf.Encode.Encoder) -> Protobuf.Decode.Decoder result -> String -> arg -> (Result Error result -> msg) -> Nats.Effect Bytes msg
Perform a request expecting a streamed reply
See https://github.com/nats-rpc/nrpc/wiki/Specifications#streamed-replies
cancelStreamRequest : String -> Nats.Effect datatype msg
Cancel a stream request given its marker
The given marker must not have the "stream/" prefix
heartbeat : Nats.State Bytes msg -> Nats.Effect Bytes msg
Send a heartbeat in all the streamed requests. Should be done every seconds or so
setStreamRequestMarker : String -> Nats.Effect datatype msg -> Nats.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.
onRequestCanceled : { sid : String, id : String, marker : Maybe String, subject : String, inbox : String } -> Nats.Effect Bytes msg
Returns a nats effect to apply when a request is canceled.
It sends the 'lastbeat' message on stream requests