The top-level sum of all available protocols is called federation. Each protocol should define its data type and (optionally) the custom handler.

Listing 1. N2O Protocols
data N2OProto a = N2ONitro (Nitro a) | N2OWorkflow (Flow a) | N2OClient (Client a) | N2OStore (Store a)

Note that in Haskell version session INIT and PING heartbeat protocols are built into N2O tract, so you don't worry about.


Each protocol consists of sum of messages. The CLIENT protocol sum has two messages: client originated and server originated messages.

Listing 2. Client/Server Protocol
data Client a = Cli a | Srv a deriving (Show)


Nitro protocol defines JavaScript postback container that delivers the parameters of UI elements alogin its session start marker.

Listing 3. Nitro Protocol
data Nitro a = Init L.ByteString | Pickle { pickleSource :: L.ByteString , picklePickled :: L.ByteString , pickleLinked :: (M.Map BS.ByteString L.ByteString) } deriving (Show)

Nitro protocol also implements a custom protocol info function which render actions accumulated after calling of page handler.

Listing 4. Protocol API
nitroProto :: (Show a) => Proto N2OProto a L.ByteString nitroInfo :: (Show a) => N2OProto a -> N2O N2OProto a L.ByteString Return

This module may refer to: TYPES, CORE