- REQUIRED METHODS
- API FOR CONNECTIONS
- API FOR CLIENTS
Message::Passing::Role::ConnectionManager - A simple manager for inputs and outputs that need to make network connections.
This role is for components which make network connections, and need to handle the connection not starting, timeouts, disconnects etc.
It provides a simple abstraction for multiple other classes to be able to use the same connection manager, and a notifies
Build and return the connection we're managing, start the connection process.
Your connection should use the API as documented below to achieve notification of connect and disconnect events.
Notify clients that the connection is now ready for use.
Notify clients that the connection is no longer ready for use.
Will cause the connection to be terminated and retried.
To use a connection manager, you should register yourself like this:
The manager will call
$self->disconnected() when appropriate.
If the manager is already connected when you subscribe, it will immediately call back into your
connected method, if it is not already connected then this will happen at a later point once the connection is established.
See Message::Passing::Role::HasAConnection for a role to help with dealing with a connection manager.
A Boolean indicating if the connection is currently considered fully connected
The connection object (if we are connected, or connecting currently) - can be undefined if we are during a reconnect timeout.
Connections will be timed out and aborted after this time if they haven't successfully connected.
Defaults to 30s
The number of seconds to wait before starting a reconnect after a connection has timed out or been aborted.
Defaults to 2s
This is called by your Input or Output, as
This is done for you by Message::Passing::Role::HasAConnection usually..
This arranges to store a weak reference to your component, allowing the connection manager to call the
->disconnect methods for any components registered when a connection is established or destroyed.
Note that if the connection manager is already connected, it will immediately call the
This module exists due to the wonderful people at Suretec Systems Ltd. <http://www.suretecsystems.com/> who sponsored its development for its VoIP division called SureVoIP <http://www.surevoip.co.uk/> for use with the SureVoIP API - <http://www.surevoip.co.uk/support/wiki/api_documentation>
==head1 AUTHOR, COPYRIGHT AND LICENSE