peb_pconnect — Open a persistent connection to an Erlang node
Establishes a persistent connection to an Erlang node.
peb_pconnect() acts very much like peb_connect() with two major differences.
First, when connecting, the function would first try to find a (persistent) link that's already open with the same server, cookie and creation. If one is found, an identifier for it will be returned instead of opening a new connection.
Second, the connection to the Erlang node will not be closed when the execution of the script ends. Instead, the link will remain open for future use.
This type of link is therefore called 'persistent'.
The Erlang node. e.g. "nodename@host.domain"
The cookie for communicate with this Erlang node.
Returns an Erlang node persistent link identifier on success, or FALSE on failure.
Example #1 peb_pconnect() example
<?php
$link = peb_pconnect('node@host.domain', 'secret_cookie');
if (!$link) {
die('Could not connect: ' . peb_error());
}
echo 'Connected successfully';
?>
The above example will output:
Connected successfully
Note: Note, that these kind of links only work if you are using a module version of PHP.