| Copyright | (c) simplex.chat |
|---|---|
| License | AGPL-3 |
| Maintainer | chat@simplex.chat |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Simplex.Messaging.Server
Description
This module defines SMP protocol server with in-memory persistence and optional append only log of SMP queue records.
See https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md
Synopsis
- runSMPServer :: MsgStoreClass s => ServerConfig s -> Maybe AttachHTTP -> IO ()
- runSMPServerBlocking :: MsgStoreClass s => TMVar Bool -> ServerConfig s -> Maybe AttachHTTP -> IO ()
- controlPortAuth :: Handle -> Maybe BasicAuth -> Maybe BasicAuth -> TVar CPClientRole -> BasicAuth -> IO ()
- importMessages :: forall s. MsgStoreClass s => Bool -> s -> FilePath -> Maybe Int64 -> Bool -> IO MessageStats
- exportMessages :: forall s. MsgStoreClass s => Bool -> MsgStore s -> FilePath -> Bool -> IO ()
- printMessageStats :: Text -> MessageStats -> IO ()
- disconnectTransport :: Transport c => THandle v c 'TServer -> TVar SystemTime -> TVar SystemTime -> ExpirationConfig -> IO Bool -> IO ()
- verifyCmdAuthorization :: Maybe (THandleAuth 'TServer) -> Maybe TAuthorizations -> ByteString -> CorrId -> APublicAuthKey -> Bool
- dummyVerifyCmd :: Maybe (THandleAuth 'TServer) -> Maybe TAuthorizations -> ByteString -> CorrId -> Bool
- randomId :: Int -> M s EntityId
- type AttachHTTP = Socket -> Context -> IO ()
- data MessageStats = MessageStats {
- storedMsgsCount :: Int
- expiredMsgsCount :: Int
- storedQueues :: Int
Documentation
runSMPServer :: MsgStoreClass s => ServerConfig s -> Maybe AttachHTTP -> IO () Source #
Runs an SMP server using passed configuration.
See a full server here: https://github.com/simplex-chat/simplexmq/blob/master/apps/smp-server/Main.hs
runSMPServerBlocking :: MsgStoreClass s => TMVar Bool -> ServerConfig s -> Maybe AttachHTTP -> IO () Source #
Runs an SMP server using passed configuration with signalling.
This function uses passed TMVar to signal when the server is ready to accept TCP requests (True) and when it is disconnected from the TCP socket once the server thread is killed (False).
controlPortAuth :: Handle -> Maybe BasicAuth -> Maybe BasicAuth -> TVar CPClientRole -> BasicAuth -> IO () Source #
importMessages :: forall s. MsgStoreClass s => Bool -> s -> FilePath -> Maybe Int64 -> Bool -> IO MessageStats Source #
exportMessages :: forall s. MsgStoreClass s => Bool -> MsgStore s -> FilePath -> Bool -> IO () Source #
printMessageStats :: Text -> MessageStats -> IO () Source #
disconnectTransport :: Transport c => THandle v c 'TServer -> TVar SystemTime -> TVar SystemTime -> ExpirationConfig -> IO Bool -> IO () Source #
verifyCmdAuthorization :: Maybe (THandleAuth 'TServer) -> Maybe TAuthorizations -> ByteString -> CorrId -> APublicAuthKey -> Bool Source #
dummyVerifyCmd :: Maybe (THandleAuth 'TServer) -> Maybe TAuthorizations -> ByteString -> CorrId -> Bool Source #
type AttachHTTP = Socket -> Context -> IO () Source #
data MessageStats Source #
Constructors
| MessageStats | |
Fields
| |
Instances
| Monoid MessageStats Source # | |
Defined in Simplex.Messaging.Server.MsgStore.Types Methods mappend :: MessageStats -> MessageStats -> MessageStats mconcat :: [MessageStats] -> MessageStats | |
| Semigroup MessageStats Source # | |
Defined in Simplex.Messaging.Server.MsgStore.Types Methods (<>) :: MessageStats -> MessageStats -> MessageStats sconcat :: NonEmpty MessageStats -> MessageStats stimes :: Integral b => b -> MessageStats -> MessageStats | |
| Show MessageStats Source # | |
Defined in Simplex.Messaging.Server.MsgStore.Types Methods showsPrec :: Int -> MessageStats -> ShowS show :: MessageStats -> String showList :: [MessageStats] -> ShowS | |