mqtt-0.1.1.0: An MQTT protocol implementation.

Copyright(c) Lars Petersen 2016
LicenseMIT
Maintainerinfo@lars-petersen.net
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Network.MQTT.Broker.Session

Description

 

Synopsis

Documentation

publish :: Session auth -> Message -> IO () Source #

disconnect :: Session auth -> IO () Source #

Disconnect a session.

terminate :: Session auth -> IO () Source #

Terminate a session.

  • An eventually connected client gets disconnected.
  • The session subscriptions are removed from the subscription tree which means that it will receive no more messages.
  • The session will be unlinked from the broker which means that clients cannot resume it anymore under this client identifier.

reset :: Session auth -> IO () Source #

Reset the session state after a reconnect.

  • All output buffers will be cleared.
  • Output buffers will be filled with retransmissions.

notePending :: Session auth -> IO () Source #

waitPending :: Session auth -> IO () Source #

enqueuePingResponse :: Session auth -> IO () Source #

Enqueue a PINGRESP to be sent as soon as the output thread is available.

The PINGRESP will be inserted with highest priority in front of all other enqueued messages.

enqueueMessage :: Session auth -> Message -> IO () Source #

This enqueues a message for transmission to the client.

  • This operations eventually terminates the session on queue overflow. The caller will not notice this and the operation will not throw an exception.

dequeue :: Session auth -> IO (Seq ServerPacket) Source #

Blocks until messages are available and prefers non-qos0 messages over qos0 messages.

processPublish :: Session auth -> PacketIdentifier -> Duplicate -> Message -> IO () Source #

Process a PUB message received from the peer.

Different handling depending on message qos.

processPublishRelease :: Session auth -> PacketIdentifier -> IO () Source #

Release a QoS2 message.

This shall be called when PUBREL has been received from the peer. It enqueues an outgoing PUBCOMP. The message is only released if the handler returned without exception. The handler is only executed if there still is a message (it is a valid scenario that it might already have been released).

processPublishReceived :: Session auth -> PacketIdentifier -> IO () Source #

Note that a QoS2 message has been received by the peer.

This shall be called when a PUBREC has been received from the peer. This is the completion of the second step in a 4-way handshake. The state changes from _not received_ to _not completed_. We will send a PUBREL to the client and expect a PUBCOMP in return.

processPublishComplete :: Session auth -> PacketIdentifier -> IO () Source #

Complete the transmission of a QoS2 message.

This shall be called when a PUBCOMP has been received from the peer to finally free the packet identifier.

processPublishAcknowledged :: Session auth -> PacketIdentifier -> IO () Source #

Note that a QoS1 message has been received by the peer.

This shall be called when a PUBACK has been received by the peer. We release the message from our buffer and the transaction is then complete.

data Session auth Source #

Instances

Eq (Session auth) Source # 

Methods

(==) :: Session auth -> Session auth -> Bool #

(/=) :: Session auth -> Session auth -> Bool #

Ord (Session auth) Source # 

Methods

compare :: Session auth -> Session auth -> Ordering #

(<) :: Session auth -> Session auth -> Bool #

(<=) :: Session auth -> Session auth -> Bool #

(>) :: Session auth -> Session auth -> Bool #

(>=) :: Session auth -> Session auth -> Bool #

max :: Session auth -> Session auth -> Session auth #

min :: Session auth -> Session auth -> Session auth #

Show (Session auth) Source # 

Methods

showsPrec :: Int -> Session auth -> ShowS #

show :: Session auth -> String #

showList :: [Session auth] -> ShowS #

newtype SessionIdentifier Source #

Constructors

SessionIdentifier Int 

Instances

Enum SessionIdentifier Source # 
Eq SessionIdentifier Source # 
Ord SessionIdentifier Source # 
Show SessionIdentifier Source # 
Generic SessionIdentifier Source # 
Binary SessionIdentifier Source # 
type Rep SessionIdentifier Source # 
type Rep SessionIdentifier = D1 (MetaData "SessionIdentifier" "Network.MQTT.Broker.Internal" "mqtt-0.1.1.0-6z0Hs5qv6meCmpWtAOex9N" True) (C1 (MetaCons "SessionIdentifier" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

data Connection Source #

Instances

Eq Connection Source # 
Ord Connection Source # 
Show Connection Source # 
Generic Connection Source # 

Associated Types

type Rep Connection :: * -> * #

Binary Connection Source # 
type Rep Connection Source # 
type Rep Connection = D1 (MetaData "Connection" "Network.MQTT.Broker.Internal" "mqtt-0.1.1.0-6z0Hs5qv6meCmpWtAOex9N" False) (C1 (MetaCons "Connection" PrefixI True) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "connectionCreatedAt") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Int64)) (S1 (MetaSel (Just Symbol "connectionCleanSession") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Bool))) ((:*:) (S1 (MetaSel (Just Symbol "connectionSecure") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Bool)) ((:*:) (S1 (MetaSel (Just Symbol "connectionWebSocket") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Bool)) (S1 (MetaSel (Just Symbol "connectionRemoteAddress") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe ByteString)))))))