remotion-0.1.0: A library for client-server applications based on custom protocols

Safe HaskellNone

Remotion.Client

Contents

Synopsis

Control

data Client i o m r Source

A monad transformer for performing actions on client-side.

Supports custom protocols with i being the type of the client request and o - the server's response.

Instances

MonadBase IO m => MonadBase IO (Client i o m) 
MonadBaseControl IO m => MonadBaseControl IO (Client i o m) 
Monad m => MonadError Failure (Client i o m) 
MonadTrans (Client i o) 
MonadTransControl (Client i o) 
Monad m => Monad (Client i o m) 
Monad m => Functor (Client i o m) 
Monad m => Applicative (Client i o m) 
MonadIO m => MonadIO (Client i o m) 

run :: forall i o m r. (Serializable IO i, Serializable IO o, MonadIO m, Applicative m, MonadBaseControl IO m) => Settings -> Client i o m r -> m (Either Failure r)Source

Run Client in the base monad.

Requires the base monad to have a MonadBaseControl instance for IO.

request :: (Serializable IO i, Serializable IO o, MonadIO m, Applicative m) => i -> Client i o m oSource

Send a request i and receive a response o.

Settings

type UserProtocolSignature = ByteStringSource

A unique identification of user's protocol version used for checking of protocol versions mismatch between client and server. It can be simply a user-supplied version number or a hash or a serialization of the representation of a type used for protocol, which can be generated using such library as type-structure.

data URL Source

Location of the server.

Constructors

Socket FilePath

Path to the socket-file.

Host Text Int Credentials

Host name, port and credentials.

type Credentials = Maybe ByteStringSource

Either a plain ASCII password or an encoding of some data, e.g. an MD5 hash of a username-password pair or just a password. In more involved scenarios you can mix in serialization, e.g. a serialized pair of username and a hash of just the password.

Nothing means anonymous.

Failure

data Failure Source

Constructors

UnreachableURL

Unable to connect to the provided url.

ServerIsBusy

Server has too many connections already. It's suggested to retry later.

Unauthenticated

Incorrect credentials.

ConnectionInterrupted

Connection got interrupted for some reason.

TimeoutReached Int

A timeout of communication with server reached.

ProtocolVersionMismatch Int Int

A mismatch of the internal protocol versions on client and server. First is the version on the client, second is the version on the server.

UserProtocolSignatureMismatch ByteString ByteString

A mismatch of the user-supplied versions of custom protocol on client and server. First is the version on the client, second is the version on the server.

CorruptRequest Text

Server reports that it was unable to deserialize the request. This is only expected to happen in case of user's protocol mismatch.