The Chicago Boss API is mostly stable, but still might change before 1.0.

BossSession is a multiadapter session management. The following adapters are supported (specified in boss.config):

BossSession is automatically started, so, by default an ETS based session support is provided.

The current session ID is available to controllers as the second module parameter. To disable sessions, set "session_enable" to "false" in your boss.config file.

BossFlash is a utility on top of boss_session, you can store messages between requests, automatically populated to the view as {{ boss_flash }} and deleted from session after used.

boss_session

new_session(Cookie::string()) -> string | {error, Reason}

Starts new session with the specified Cookie.

get_session_data(SessionID) -> list | {error, Reason}

Get session data for the SessionID.

get_session_data(SessionID, Key) -> list | {error, Reason}

Get session data for the SessionID for a given Key.

set_session_data(SessionID, Key, Value) -> ok | {error, Reason}

Set session data for the SessionID.

delete_session(SessionID) -> ok | {error, Reason}

Delete session for given SessionID.

remove_session_data(SessionID, Key) -> ok | {error, Reason}

Remove the Key from session data for the SessionID.

boss_flash

Add flash messages in the controller like:

boss_flash:add(SessionID, notice, "Flash Title", "Flash Message")

Use the boss_flash var in the view, should render "notice - Flash Title - Flash Message":

{% for flash in boss_flash %} {{ flash.method }} - {{ flash.title }} - {{ flash.message }} {% endfor %}

Functions

get_and_clear(SessionID) -> [Message]

Retrieve the current flash messages for SessionID and flush the message stack.

add(SessionID, Type, Title) -> ok | {error, Reason}

Add a message to the flash message stack for SessionID.

add(SessionID, Type, Title, Message) -> ok | {error, Reason}

Add a message to the flash message stack for SessionID.

add(SessionID, Type, Title, Message, Data) -> ok | {error, Reason}

Add a message to the flash message stack for SessionID.