simplexmq-6.5.0.16: SimpleXMQ message broker
Safe HaskellSafe-Inferred
LanguageHaskell2010

Simplex.Messaging.Notifications.Protocol

Documentation

data NtfEntity Source #

Constructors

Token 
Subscription 

Instances

Instances details
Show NtfEntity Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

showsPrec :: Int -> NtfEntity -> ShowS

show :: NtfEntity -> String

showList :: [NtfEntity] -> ShowS

TestEquality SNtfEntity Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

testEquality :: forall (a :: k) (b :: k). SNtfEntity a -> SNtfEntity b -> Maybe (a :~: b)

data SNtfEntity :: NtfEntity -> Type where Source #

Instances

Instances details
TestEquality SNtfEntity Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

testEquality :: forall (a :: k) (b :: k). SNtfEntity a -> SNtfEntity b -> Maybe (a :~: b)

Show (SNtfEntity e) Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

showsPrec :: Int -> SNtfEntity e -> ShowS

show :: SNtfEntity e -> String

showList :: [SNtfEntity e] -> ShowS

data NtfCmdTag Source #

Constructors

forall e.NtfEntityI e => NCT (SNtfEntity e) (NtfCommandTag e) 

Instances

Instances details
Encoding NtfCmdTag Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

smpEncode :: NtfCmdTag -> ByteString Source #

smpDecode :: ByteString -> Either String NtfCmdTag Source #

smpP :: Parser NtfCmdTag Source #

ProtocolMsgTag NtfCmdTag Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

decodeTag :: ByteString -> Maybe NtfCmdTag Source #

newtype NtfRegCode Source #

Constructors

NtfRegCode ByteString 

Instances

Instances details
FromJSON NtfRegCode Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

parseJSON :: Value -> Parser NtfRegCode

parseJSONList :: Value -> Parser [NtfRegCode]

omittedField :: Maybe NtfRegCode

ToJSON NtfRegCode Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

toJSON :: NtfRegCode -> Value

toEncoding :: NtfRegCode -> Encoding

toJSONList :: [NtfRegCode] -> Value

toEncodingList :: [NtfRegCode] -> Encoding

omitField :: NtfRegCode -> Bool

Show NtfRegCode Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

showsPrec :: Int -> NtfRegCode -> ShowS

show :: NtfRegCode -> String

showList :: [NtfRegCode] -> ShowS

Eq NtfRegCode Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

(==) :: NtfRegCode -> NtfRegCode -> Bool

(/=) :: NtfRegCode -> NtfRegCode -> Bool

Encoding NtfRegCode Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

smpEncode :: NtfRegCode -> ByteString Source #

smpDecode :: ByteString -> Either String NtfRegCode Source #

smpP :: Parser NtfRegCode Source #

StrEncoding NtfRegCode Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

strEncode :: NtfRegCode -> ByteString Source #

strDecode :: ByteString -> Either String NtfRegCode Source #

strP :: Parser NtfRegCode Source #

data NewNtfEntity (e :: NtfEntity) where Source #

Instances

Instances details
Show (NewNtfEntity e) Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

showsPrec :: Int -> NewNtfEntity e -> ShowS

show :: NewNtfEntity e -> String

showList :: [NewNtfEntity e] -> ShowS

NtfEntityI e => Encoding (NewNtfEntity e) Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

smpEncode :: NewNtfEntity e -> ByteString Source #

smpDecode :: ByteString -> Either String (NewNtfEntity e) Source #

smpP :: Parser (NewNtfEntity e) Source #

data ANewNtfEntity Source #

Constructors

forall e.NtfEntityI e => ANE (SNtfEntity e) (NewNtfEntity e) 

Instances

Instances details
Show ANewNtfEntity Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

showsPrec :: Int -> ANewNtfEntity -> ShowS

show :: ANewNtfEntity -> String

showList :: [ANewNtfEntity] -> ShowS

Encoding ANewNtfEntity Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

smpEncode :: ANewNtfEntity -> ByteString Source #

smpDecode :: ByteString -> Either String ANewNtfEntity Source #

smpP :: Parser ANewNtfEntity Source #

data NtfCommand (e :: NtfEntity) where Source #

Constructors

TNEW :: NewNtfEntity 'Token -> NtfCommand 'Token

register new device token for notifications

TVFY :: NtfRegCode -> NtfCommand 'Token

verify token - uses e2e encrypted random string sent to the device via PN to confirm that the device has the token

TCHK :: NtfCommand 'Token

check token status

TRPL :: DeviceToken -> NtfCommand 'Token

replace device token (while keeping all existing subscriptions)

TDEL :: NtfCommand 'Token

delete token - all subscriptions will be removed and no more notifications will be sent

TCRN :: Word16 -> NtfCommand 'Token

enable periodic background notification to fetch the new messages - interval is in minutes, minimum is 20, 0 to disable

SNEW :: NewNtfEntity 'Subscription -> NtfCommand 'Subscription

create SMP subscription

SCHK :: NtfCommand 'Subscription

check SMP subscription status (response is SUB)

SDEL :: NtfCommand 'Subscription

delete SMP subscription

PING :: NtfCommand 'Subscription

keep-alive command

Instances

Instances details
NtfEntityI e => ProtocolEncoding NTFVersion ErrorType (NtfCommand e) Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Associated Types

type Tag (NtfCommand e) Source #

Show (NtfCommand e) Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

showsPrec :: Int -> NtfCommand e -> ShowS

show :: NtfCommand e -> String

showList :: [NtfCommand e] -> ShowS

type Tag (NtfCommand e) Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

data NtfCmd Source #

Constructors

forall e.NtfEntityI e => NtfCmd (SNtfEntity e) (NtfCommand e) 

Instances

Instances details
Show NtfCmd Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

showsPrec :: Int -> NtfCmd -> ShowS

show :: NtfCmd -> String

showList :: [NtfCmd] -> ShowS

ProtocolEncoding NTFVersion ErrorType NtfCmd Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Associated Types

type Tag NtfCmd Source #

type Tag NtfCmd Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

data NtfResponseTag Source #

Instances

Instances details
Show NtfResponseTag Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

showsPrec :: Int -> NtfResponseTag -> ShowS

show :: NtfResponseTag -> String

showList :: [NtfResponseTag] -> ShowS

Encoding NtfResponseTag Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

smpEncode :: NtfResponseTag -> ByteString Source #

smpDecode :: ByteString -> Either String NtfResponseTag Source #

smpP :: Parser NtfResponseTag Source #

ProtocolMsgTag NtfResponseTag Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

decodeTag :: ByteString -> Maybe NtfResponseTag Source #

data NtfResponse Source #

Instances

Instances details
Show NtfResponse Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

showsPrec :: Int -> NtfResponse -> ShowS

show :: NtfResponse -> String

showList :: [NtfResponse] -> ShowS

Protocol NTFVersion ErrorType NtfResponse Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Associated Types

type ProtoCommand NtfResponse = (cmd :: Type) Source #

type ProtoType NtfResponse = (sch :: ProtocolType) Source #

ProtocolEncoding NTFVersion ErrorType NtfResponse Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Associated Types

type Tag NtfResponse Source #

type ProtoCommand NtfResponse Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

type ProtoType NtfResponse Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

type Tag NtfResponse Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

data SMPQueueNtf Source #

Instances

Instances details
Show SMPQueueNtf Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

showsPrec :: Int -> SMPQueueNtf -> ShowS

show :: SMPQueueNtf -> String

showList :: [SMPQueueNtf] -> ShowS

Eq SMPQueueNtf Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

(==) :: SMPQueueNtf -> SMPQueueNtf -> Bool

(/=) :: SMPQueueNtf -> SMPQueueNtf -> Bool

Ord SMPQueueNtf Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Encoding SMPQueueNtf Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

smpEncode :: SMPQueueNtf -> ByteString Source #

smpDecode :: ByteString -> Either String SMPQueueNtf Source #

smpP :: Parser SMPQueueNtf Source #

StrEncoding SMPQueueNtf Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

strEncode :: SMPQueueNtf -> ByteString Source #

strDecode :: ByteString -> Either String SMPQueueNtf Source #

strP :: Parser SMPQueueNtf Source #

data PushProvider Source #

Instances

Instances details
Show PushProvider Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

showsPrec :: Int -> PushProvider -> ShowS

show :: PushProvider -> String

showList :: [PushProvider] -> ShowS

Eq PushProvider Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

(==) :: PushProvider -> PushProvider -> Bool

(/=) :: PushProvider -> PushProvider -> Bool

Ord PushProvider Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Encoding PushProvider Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

smpEncode :: PushProvider -> ByteString Source #

smpDecode :: ByteString -> Either String PushProvider Source #

smpP :: Parser PushProvider Source #

StrEncoding PushProvider Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

strEncode :: PushProvider -> ByteString Source #

strDecode :: ByteString -> Either String PushProvider Source #

strP :: Parser PushProvider Source #

FromField PushProvider Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

fromField :: FieldParser PushProvider #

ToField PushProvider Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

toField :: PushProvider -> SQLData #

data DeviceToken Source #

Constructors

DeviceToken PushProvider ByteString 

Instances

Instances details
FromJSON DeviceToken Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

parseJSON :: Value -> Parser DeviceToken

parseJSONList :: Value -> Parser [DeviceToken]

omittedField :: Maybe DeviceToken

ToJSON DeviceToken Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

toJSON :: DeviceToken -> Value

toEncoding :: DeviceToken -> Encoding

toJSONList :: [DeviceToken] -> Value

toEncodingList :: [DeviceToken] -> Encoding

omitField :: DeviceToken -> Bool

Show DeviceToken Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

showsPrec :: Int -> DeviceToken -> ShowS

show :: DeviceToken -> String

showList :: [DeviceToken] -> ShowS

Eq DeviceToken Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

(==) :: DeviceToken -> DeviceToken -> Bool

(/=) :: DeviceToken -> DeviceToken -> Bool

Ord DeviceToken Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Encoding DeviceToken Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

smpEncode :: DeviceToken -> ByteString Source #

smpDecode :: ByteString -> Either String DeviceToken Source #

smpP :: Parser DeviceToken Source #

StrEncoding DeviceToken Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

strEncode :: DeviceToken -> ByteString Source #

strDecode :: ByteString -> Either String DeviceToken Source #

strP :: Parser DeviceToken Source #

data PNMessageData Source #

Constructors

PNMessageData 

Instances

Instances details
Show PNMessageData Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

showsPrec :: Int -> PNMessageData -> ShowS

show :: PNMessageData -> String

showList :: [PNMessageData] -> ShowS

StrEncoding PNMessageData Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

strEncode :: PNMessageData -> ByteString Source #

strDecode :: ByteString -> Either String PNMessageData Source #

strP :: Parser PNMessageData Source #

data NtfSubStatus Source #

Constructors

NSNew

state after SNEW

NSPending

pending connection/subscription to SMP server

NSActive

connected and subscribed to SMP server

NSInactive

disconnected/unsubscribed from SMP server

NSEnd

END received

NSDeleted

DELD received (connection was deleted)

NSAuth

SMP AUTH error

NSService

SMP SERVICE error - rejected service signature on individual subscriptions

NSErr ByteString

SMP error other than AUTH

Instances

Instances details
Show NtfSubStatus Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

showsPrec :: Int -> NtfSubStatus -> ShowS

show :: NtfSubStatus -> String

showList :: [NtfSubStatus] -> ShowS

Eq NtfSubStatus Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

(==) :: NtfSubStatus -> NtfSubStatus -> Bool

(/=) :: NtfSubStatus -> NtfSubStatus -> Bool

Ord NtfSubStatus Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Encoding NtfSubStatus Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

smpEncode :: NtfSubStatus -> ByteString Source #

smpDecode :: ByteString -> Either String NtfSubStatus Source #

smpP :: Parser NtfSubStatus Source #

StrEncoding NtfSubStatus Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

strEncode :: NtfSubStatus -> ByteString Source #

strDecode :: ByteString -> Either String NtfSubStatus Source #

strP :: Parser NtfSubStatus Source #

data NtfTknStatus Source #

Constructors

NTNew

Token created in DB

NTRegistered

state after registration (TNEW)

NTInvalid (Maybe NTInvalidReason)

if initial notification failed (push provider error) or verification failed

NTConfirmed

Token confirmed via notification (accepted by push provider or verification code received by client)

NTActive

after successful verification (TVFY)

NTExpired

after it is no longer valid (push provider error)

Instances

Instances details
FromJSON NtfTknStatus Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

parseJSON :: Value -> Parser NtfTknStatus

parseJSONList :: Value -> Parser [NtfTknStatus]

omittedField :: Maybe NtfTknStatus

ToJSON NtfTknStatus Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

toJSON :: NtfTknStatus -> Value

toEncoding :: NtfTknStatus -> Encoding

toJSONList :: [NtfTknStatus] -> Value

toEncodingList :: [NtfTknStatus] -> Encoding

omitField :: NtfTknStatus -> Bool

Show NtfTknStatus Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

showsPrec :: Int -> NtfTknStatus -> ShowS

show :: NtfTknStatus -> String

showList :: [NtfTknStatus] -> ShowS

Eq NtfTknStatus Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

(==) :: NtfTknStatus -> NtfTknStatus -> Bool

(/=) :: NtfTknStatus -> NtfTknStatus -> Bool

Encoding NtfTknStatus Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

smpEncode :: NtfTknStatus -> ByteString Source #

smpDecode :: ByteString -> Either String NtfTknStatus Source #

smpP :: Parser NtfTknStatus Source #

StrEncoding NtfTknStatus Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

strEncode :: NtfTknStatus -> ByteString Source #

strDecode :: ByteString -> Either String NtfTknStatus Source #

strP :: Parser NtfTknStatus Source #

FromField NtfTknStatus Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

fromField :: FieldParser NtfTknStatus #

ToField NtfTknStatus Source # 
Instance details

Defined in Simplex.Messaging.Notifications.Protocol

Methods

toField :: NtfTknStatus -> SQLData #

encodePNMessages :: NonEmpty PNMessageData -> ByteString Source #

pnMessagesP :: Parser (NonEmpty PNMessageData) Source #

checkEntity :: forall t e e'. (NtfEntityI e, NtfEntityI e') => t e' -> Either String (t e) Source #