peb_pconnect

peb_pconnectOpen a persistent connection to an Erlang node

Description

resource peb_pconnect ( string $server , string $cookie )

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'.

Parameters

server

The Erlang node. e.g. "nodename@host.domain"

cookie

The cookie for communicate with this Erlang node.

Return Values

Returns an Erlang node persistent link identifier on success, or FALSE on failure.

Examples

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

Notes

Note: Note, that these kind of links only work if you are using a module version of PHP.

See Also