Module z_session_page

Page session for interaction with the page displayed on the user agent.

Copyright 2009-2013 Marc Worrell

Behaviours: gen_server.

Authors: Marc Worrell (marc@worrell.nl).

Description

Page session for interaction with the page displayed on the user agent. Support for comet polls and websocket. The page session is the switchboard for getting data pushed to the user agent. All queued requests can be sent via the current request being handled, via a comet poll or a websocket connection.

Function Index

add_script/1Split the scripts from the context and add the scripts to the page.
add_script/2Send a script to the user agent, will be queued and send when the comet process attaches.
append/3
auth_change/1
check_timeout/1Kill this page when timeout has been reached.
code_change/3Convert process state when code is changed.
comet_attach/2Attach the comet request process to the page session, enabling sending scripts to the user agent.
comet_detach/1Called when the comet request process closes, we will need to wait for the next connection.
get/2
get_attach_state/1
get_transport_data/1Called by the comet process or the page request to fetch any queued transport messages.
handle_call/3Handling call messages.
handle_cast/2
handle_info/2
incr/3
init/1Initiates the server, initialises the pid lookup dicts.
page_id/1
ping/1Receive a ping, makes sure that we stay alive.
receive_ack/2Receive an ack for a sent message.
receive_ack/3
session_pid/1
set/3
spawn_link/4Spawn a new process, linked to the page pid.
start_link/3Starts the person manager server.
stop/1
terminate/2Terminate all processes coupled to the page.
transport/2Send a msg to the pages, queue if no page-transport attached.
transport/3
websocket_attach/2
websocket_attach/3Attach the websocket request process to the page session, enabling sending scripts to the user agent.
whereis/2

Function Details

add_script/1

add_script(Context) -> any()

Split the scripts from the context and add the scripts to the page.

add_script/2

add_script(Script, Context) -> any()

Send a script to the user agent, will be queued and send when the comet process attaches

append/3

append(Key, Value, Context) -> any()

auth_change/1

auth_change(Pid) -> any()

check_timeout/1

check_timeout(Pid) -> any()

Kill this page when timeout has been reached

code_change/3

code_change(OldVsn, State, Extra) -> {ok, NewState}

Convert process state when code is changed

comet_attach/2

comet_attach(CometPid, Pid) -> any()

Attach the comet request process to the page session, enabling sending scripts to the user agent

comet_detach/1

comet_detach(Pid) -> any()

Called when the comet request process closes, we will need to wait for the next connection

get/2

get(Key, Context) -> any()

get_attach_state/1

get_attach_state(Context) -> any()

get_transport_data/1

get_transport_data(Pid) -> any()

Called by the comet process or the page request to fetch any queued transport messages

handle_call/3

handle_call(Message::Request, From, State) -> {reply, Reply, State} | {reply, Reply, State, Timeout} | {noreply, State} | {noreply, State, Timeout} | {stop, Reason, Reply, State} | {stop, Reason, State}

Handling call messages

handle_cast/2

handle_cast(Message::Msg, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}

handle_info/2

handle_info(X1::Info, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}

incr/3

incr(Key, Value, Context) -> any()

init/1

init(X1::Args) -> {ok, State} | {ok, State, Timeout} | ignore | {stop, Reason}

Initiates the server, initialises the pid lookup dicts

page_id/1

page_id(Context) -> any()

ping/1

ping(Pid) -> any()

Receive a ping, makes sure that we stay alive

receive_ack/2

receive_ack(Ack, Context) -> any()

Receive an ack for a sent message

receive_ack/3

receive_ack(Ack, PageId, Context) -> any()

session_pid/1

session_pid(Context) -> any()

set/3

set(Key, Value, Context) -> any()

spawn_link/4

spawn_link(Module, Func, Args, Context) -> any()

Spawn a new process, linked to the page pid

start_link/3

start_link(SessionPid::pid(), PageId::binary(), Context::#context{}) -> {ok, pid()} | {error, term()}

Starts the person manager server

stop/1

stop(Context) -> any()

terminate/2

terminate(Reason, State) -> void()

Terminate all processes coupled to the page.

transport/2

transport(Msg, Context) -> any()

Send a msg to the pages, queue if no page-transport attached

transport/3

transport(Msg, PageId, Context) -> any()

websocket_attach/2

websocket_attach(WsPid, Context) -> any()

websocket_attach/3

websocket_attach(WsPid, PageId, Context) -> any()

Attach the websocket request process to the page session, enabling sending scripts to the user agent

whereis/2

whereis(PageId, Context) -> any()


Generated by EDoc, Dec 20 2014, 02:32:38.