Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
216 lines (131 sloc) 5.97 KB

Module snatch

Behaviours: gen_server.

Data Types

claws()


claws() = claws_rabbitmq | claws_xmpp | claws_xmpp_comp

jid()


jid() = binary()

Function Index

code_change/3
connected/1reports to the implementation callback the connection (claw) is up.
disconnected/1reports to the implementation callback the connecgtion (claw) is down.
handle_call/3
handle_cast/2
handle_info/2
init/1initialize the snatch process.
received/1received Data, it will be handled directly via the implementation.
received/2received Data, it will be handled directly via the implementation adding the route to know where to send the next data.
send/1send Data to the external connection using the default claw configured at start of snatch and <<"unknown">> as JID.
send/2send Data to the external connection using a claw based on the JID passed as a param.
send/3send data to the external connection using a claw based on the JID passed as a param.
start_link/2starts the server using snatch as registered name, using Claws param to know what kind of handling of connection to use and PID or Process Name for receive the information comming from the claws.
start_link/3starts the server using snatch as registered name, using Claws param to know what kind of handling of connection to use and Module for the callbacks to send the received information.
stop/0stops the snatch server.
terminate/2

Function Details

code_change/3

code_change(OldVsn, State, Extra) -> any()

connected/1


connected(Data::term()) -> ok

reports to the implementation callback the connection (claw) is up.

disconnected/1


disconnected(Data::term()) -> ok

reports to the implementation callback the connecgtion (claw) is down.

handle_call/3

handle_call(Call, From, S) -> any()

handle_cast/2

handle_cast(Msg, State) -> any()

handle_info/2

handle_info(Info, S) -> any()

init/1


init(X1::[term()]) -> {ok, #state{claws = claws(), callback = module(), substate = term()}} | {stop, Reason::atom()}

initialize the snatch process. It could be only one per node.

received/1


received(Data::term()) -> ok

received Data, it will be handled directly via the implementation.

received/2


received(Data::term(), Via::#via{}) -> ok

received Data, it will be handled directly via the implementation adding the route to know where to send the next data.

send/1


send(Data::term()) -> ok

send Data to the external connection using the default claw configured at start of snatch and <<"unknown">> as JID.

send/2


send(Data::term(), JID::jid()) -> ok

send Data to the external connection using a claw based on the JID passed as a param.

send/3


send(Data::term(), JID::jid(), ID::binary()) -> ok

send data to the external connection using a claw based on the JID passed as a param. The ID is sent directly to the claw with the data.

start_link/2


start_link(Claws::claws(), PIDorName::pid() | atom()) -> {ok, pid()} | {error, any()}

starts the server using snatch as registered name, using Claws param to know what kind of handling of connection to use and PID or Process Name for receive the information comming from the claws.

start_link/3


start_link(Claws::claws(), Module::module(), Args::[term()]) -> {ok, pid()} | {error, any()}

starts the server using snatch as registered name, using Claws param to know what kind of handling of connection to use and Module for the callbacks to send the received information. Args could be whatever you need to pass to your init/1 callback.

stop/0


stop() -> ok

stops the snatch server.

terminate/2

terminate(Reason, State) -> any()

You can’t perform that action at this time.