From 223931bc93f927d7e69799ba202dfa364005a32f Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Mon, 11 May 2020 20:51:08 +0100 Subject: [PATCH] Subscribe recipient command stub --- definitions/src/Simplex/Messaging/Client.hs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/definitions/src/Simplex/Messaging/Client.hs b/definitions/src/Simplex/Messaging/Client.hs index 93d3fe81f5..8d3702f925 100644 --- a/definitions/src/Simplex/Messaging/Client.hs +++ b/definitions/src/Simplex/Messaging/Client.hs @@ -11,6 +11,7 @@ module Simplex.Messaging.Client where import ClassyPrelude +import Data.Singletons.TH import Simplex.Messaging.Protocol import Simplex.Messaging.Types @@ -26,8 +27,28 @@ instance Prf HasState Sender s action = CreateConn protoAction = rCreateConn +instance ( (r /= None && r /= Disabled) ~ True + , (b /= None && b /= Disabled) ~ True + , Prf HasState Sender s ) + => ProtocolActionOf Recipient + () () + Recipient Broker + (r <==> b <==| s) + (r <==> b <==| s) + Idle Subscribed n n + where + action = Subscribe + protoAction = rSubscribe + + rCreateConn :: Connection Recipient None Idle -> CreateConnRequest -> Either String CreateConnResponse -> Either String (Connection Recipient New Idle) rCreateConn = protoActionStub + +rSubscribe :: Connection Recipient s Idle + -> () + -> Either String () + -> Either String (Connection Recipient s Subscribed) +rSubscribe = protoActionStub