The nitro_n2o module provides Nitrogen Web Framework protocol specification and implementation.


Init message invokes event(init) function in page module. There are two binary representations of INIT message. The first one is BERT encoded #init record with binary token that usually issued by n2o_session, transported in #io record as data parameter and stored on client side in localStorage or Key Chain. Clients with invalid tokens are being registered and reissued.

-record(init, { token :: binary() }).

The second one is TEXT encoded version of message, <<"N2O,">> that usually works for hosts with raw binary falicities as WebSockets.


For token issue protocol see n2o_session module.


PICKLE message sends to server prerendered (by server) encrypted message. These messages hold #ev record with callee information (encrypted). Such pickled messages can prolongate expiration field in session token (renewed) by updating client token on each UI request (tracking user activity) when n2o application variable nitro_prolongate equals true.

-record(pickle, { source = [] :: [] | binary(), pickled = [] :: [] | binary(), args = [] :: list({atom(),any()}) }). -record(ev, { module = [] :: [] | atom(), msg = [] :: any(), trigger = [] :: [] | binary(), name = [] :: [] | binary() }).


Direct message sends data without any conversion or encryption or session logic.

-record(direct, { data = [] :: any() }).


Flush message only redirects data to the socket.

-record(flush, { data = [] :: [] | list(#action{}) }).

You may also want to read: n2o_heart, n2o_ftp.