NAME

Object::Remote::ConnectionServer - Listen for incoming Object::Remote connections

SYNOPSIS

use Object::Remote::ConnectionServer;

my $server = Object::Remote::ConnectionServer->new(
  listen_on => '/tmp/object-remote.sock',
);

$server->run;

DESCRIPTION

Object::Remote::ConnectionServer creates a server-side listener for incoming Object::Remote connections from Object::Remote::Connector::UNIX.

The listen_on attribute is coerced into a listening IO::Socket::UNIX handle if it is given a pathname. When a connection arrives, it is accepted and passed to Object::Remote::Connection using the same handle for both input and output.

The server registers itself with the current Object::Remote event loop during construction and remains active until the object is destroyed or the loop is stopped.

ATTRIBUTES

listen_on

A listening socket or a pathname for a Unix domain socket.

If a pathname is provided, any existing socket at that path is removed and a new IO::Socket::UNIX listener is created.

connection_args

Array reference of additional arguments passed to Object::Remote::Connection when a client connects.

Defaults to an empty array reference.

connection_callback

Code reference invoked on the newly created connection object after it is constructed.

Defaults to an identity-style callback that returns the connection object unchanged.

METHODS

run

Runs the current Object::Remote event loop while the server is wanted.

SEE ALSO

Object::Remote, Object::Remote::Connection, IO::Socket::UNIX