# Module ubf_client # * [Description](#description) * [Data Types](#types) * [Function Index](#index) * [Function Details](#functions)

UBF client-side public API.

This module implements most of the commonly-used client-side
functions required to talk to UBF servers:
. ## Data Types ## ### host() ###

host() = nonempty_string()
### ipport() ###

ipport() = pos_integer()
### name() ###

name() = atom()
### options() ###

options() = [{atom(), term()}]
### plugin() ###

plugin() = module()
### plugins() ###

plugins() = [plugin()]
### server() ###

server() = name() | pid()
### service() ###

service() = {'#S', nonempty_string()} | undefined
### statename() ###

statename() = atom()
### tlogger() ###

tlogger() = module()
## Function Index ##
connect/2

Connect to a UBF server at address Host + TCP port Port.

.
connect/3

Connect to a UBF server at address Host + TCP port Port.

.
connect/4

Connect to a UBF server at address Host + TCP port Port, or at pid/registered name Server.

When using the alternate form, the first two arguments are:
  • Plugins: a plugin_module_list().

  • Server: either a process id (pid()) or process registered name (atom()) for an already-started UBF server.

    See the docs for +ubf_server:start_link()+ for a description of the
    +Options+ proplist.
.
install_default_handler/1

Install a default handler function (callback-style) for asynchronous UBF messages.

The default handler function, drop_fun/1, does nothing.
.
install_handler/2

Install a handler function (callback-style) for asynchronous UBF messages.

The handler fun Fun should be a function of arity 1.  When an
asynchronous UBF message is received, the callback function will be
called with the UBF message as its single argument.  The Fun is
called by the ubf client process so the Fun can crash and/or block
this process.
If your handler fun must maintain its own state, then you must use
an intermediate anonymous fun to bind the state.  See the usage of
the +irc_client_gs:send_self/2+ fun as an example.  The
+send_self()+ fun is actually arity 2, but the extra argument is
how the author, Joe Armstrong, maintains the extra state required
to deliver the async UBF message to the process that is executing
the event loop processing function, +irc_client_gs:loop/6+.
.
lpc/2

Perform a synchronous LPC (local procedure) call with the state none.

.
lpc/3

Perform a synchronous LPC (local procedure) call with the specified state.

.
lpc/4
rpc/2

Perform a synchronous RPC call.

NOTE: It is not recommended that a UBF client return the bare atom
+timeout+ in response to any RPC call.
.
rpc/3

Perform a synchronous RPC call.

.
sendEvent/2

Send an asynchronous UBF message.

.
stop/1

Stop a UBF client process.

.
## Function Details ## ### connect/2 ###

connect(Host::host() | plugins(), Port::ipport() | server()) -> {ok, Client::pid(), service()} | {error, term()}


Connect to a UBF server at address Host + TCP port Port.

### connect/3 ###

connect(Host::host() | plugins(), Port::ipport() | server(), Timeout::timeout()) -> {ok, Client::pid(), service()} | {error, term()}


Connect to a UBF server at address Host + TCP port Port.

### connect/4 ###

connect(X::host() | plugins(), Y::ipport() | server(), Options::options(), Timeout::timeout()) -> {ok, Client::pid(), service()} | {error, term()}


Connect to a UBF server at address Host + TCP port Port, or at pid/registered name Server.

When using the alternate form, the first two arguments are:
### install_default_handler/1 ###

install_default_handler(Client::pid()) -> ack


Install a default handler function (callback-style) for asynchronous UBF messages.

The default handler function, drop_fun/1, does nothing.
### install_handler/2 ###

install_handler(Client::pid(), Fun::function()) -> ack


Install a handler function (callback-style) for asynchronous UBF messages.

The handler fun Fun should be a function of arity 1.  When an
asynchronous UBF message is received, the callback function will be
called with the UBF message as its single argument.  The Fun is
called by the ubf client process so the Fun can crash and/or block
this process.
If your handler fun must maintain its own state, then you must use
an intermediate anonymous fun to bind the state.  See the usage of
the +irc_client_gs:send_self/2+ fun as an example.  The
+send_self()+ fun is actually arity 2, but the extra argument is
how the author, Joe Armstrong, maintains the extra state required
to deliver the async UBF message to the process that is executing
the event loop processing function, +irc_client_gs:loop/6+.
### lpc/2 ###

lpc(Mod::plugin(), Call::term()) -> term()


Perform a synchronous LPC (local procedure) call with the state none.

### lpc/3 ###

lpc(Mod::plugin(), Call::term(), State::statename()) -> term()


Perform a synchronous LPC (local procedure) call with the specified state.

### lpc/4 ###

lpc(Mod::plugin(), Call::term(), State::statename(), TLogMod::tlogger()) -> term()


### rpc/2 ###

rpc(Client::pid(), Call::term()) -> timeout | term() | no_return()


Perform a synchronous RPC call.

NOTE: It is not recommended that a UBF client return the bare atom
+timeout+ in response to any RPC call.
### rpc/3 ###

rpc(Client::pid(), Call::term(), Timeout::timeout()) -> timeout | term() | no_return()


Perform a synchronous RPC call.

### sendEvent/2 ###

sendEvent(Handler::pid(), Cast::term()) -> ok | no_return()


Send an asynchronous UBF message.

### stop/1 ###

stop(Client::pid()) -> ok


Stop a UBF client process.