$loop
$loop : \React\EventLoop\LoopInterface
Event loop
IRC client implementation based on the React component library.
$loop : \React\EventLoop\LoopInterface
Event loop
$logger : \Psr\Log\LoggerInterface
Logging stream
$secureConnector : \React\SocketClient\SecureConnector
Connector used to establish SSL connections
$resolver : \React\Dns\Resolver\Resolver
setLoop(\React\EventLoop\LoopInterface $loop)
Sets the event loop dependency.
\React\EventLoop\LoopInterface | $loop |
getLoop() : \React\EventLoop\LoopInterface
Returns the event loop dependency, initializing it if needed.
setResolver(\React\Dns\Resolver\Resolver $resolver)
Sets the DNS Resolver.
\React\Dns\Resolver\Resolver | $resolver |
getResolver() : \React\Dns\Resolver\Resolver
Get the DNS Resolver, if one isn't set in instance will be created.
getLogger() : \Psr\Log\LoggerInterface
Returns a stream instance for logging data on the socket connection.
setLogger(\Psr\Log\LoggerInterface $logger)
Sets a logger for logging data on the socket connection.
\Psr\Log\LoggerInterface | $logger |
addConnection(\Phergie\Irc\ConnectionInterface $connection)
Initializes an IRC connection.
Emits connect.before.each and connect.after.each events before and after connection attempts are established, respectively.
Emits a connect.error event if a connection attempt fails.
\Phergie\Irc\ConnectionInterface | $connection | Metadata for connection to establish |
if unable to establish the connection
run(\Phergie\Irc\ConnectionInterface|\Phergie\Irc\ConnectionInterface[] $connections)
Executes the event loop, which continues running until no active connections remain.
\Phergie\Irc\ConnectionInterface|\Phergie\Irc\ConnectionInterface[] | $connections |
addTimer(\Phergie\Irc\Client\React\numeric $interval, callable $callback) : \React\Event\Timer\TimerInterface
Adds a one-time callback to execute after a specified amount of time has passed. Proxies to addTimer() implementation of the event loop implementation returned by getLoop().
\Phergie\Irc\Client\React\numeric | $interval | Number of seconds to wait before executing
|
callable | $callback | Callback to execute |
Added timer
addPeriodicTimer(\Phergie\Irc\Client\React\numeric $interval, callable $callback) : \React\Event\Timer\TimerInterface
Adds a recurring callback to execute on a specified interval. Proxies to addPeriodTimer() implementation of the event loop implementation returned by getLoop().
\Phergie\Irc\Client\React\numeric | $interval | Number of seconds to wait between executions of callback |
callable | $callback | Callback to execute |
Added timer
cancelTimer(\React\Event\Timer\TimerInterface $timer)
Cancels a specified timer created using addTimer() or addPeriodicTimer(). Proxies to the cancelTimer() implementation of the event loop implementation returned by getLoop().
\React\Event\Timer\TimerInterface | $timer | Timer returned by
|
isTimerActive(\React\Event\Timer\TimerInterface $timer) : boolean
Checks if a timer created using addTimer() or addPeriodicTimer() is active. Proxies to the isTimerActive() implementation of the event loop implementation returned by getLoop().
\React\Event\Timer\TimerInterface | $timer | Timer returned by
|
TRUE if the specified timer is active, FALSE otherwise
getSocket(string $remote, array $context) : resource
Returns a socket configured for a specified remote.
string | $remote | Address to connect the socket to (e.g. tcp://irc.freenode.net:6667) |
array | $context | Context options for the socket |
if unable to connect to the specified remote
getTransport(\Phergie\Irc\ConnectionInterface $connection) : string
Derives the transport for a given connection.
\Phergie\Irc\ConnectionInterface | $connection |
Transport usable in the URI for a stream
getForceIpv4Flag(\Phergie\Irc\ConnectionInterface $connection) : boolean
Extracts the value of the force-ipv4 option from a given connection.
\Phergie\Irc\ConnectionInterface | $connection |
TRUE to force use of IPv4, FALSE otherwise
getRemote(\Phergie\Irc\ConnectionInterface $connection) : string
Derives a remote for a given connection.
\Phergie\Irc\ConnectionInterface | $connection |
Remote usable to establish a socket connection
getContext(\Phergie\Irc\ConnectionInterface $connection) : array
Derives a set of socket context options for a given connection.
\Phergie\Irc\ConnectionInterface | $connection |
Associative array of context option key-value pairs
getStream(resource $socket) : \React\Stream\DuplexStreamInterface
Returns a stream for a socket connection.
resource | $socket | Socket for the connection to the server |
addLogging(\Evenement\EventEmitter $emitter, \Phergie\Irc\ConnectionInterface $connection)
Adds an event listener to log data emitted by a stream.
\Evenement\EventEmitter | $emitter | |
\Phergie\Irc\ConnectionInterface | $connection | Connection
|
getReadStream(\Phergie\Irc\ConnectionInterface $connection) : \Phergie\Irc\Client\React\ReadStream
Returns a stream instance for parsing messages from the server and emitting them as events.
\Phergie\Irc\ConnectionInterface | $connection | Connection
|
getWriteStream(\Phergie\Irc\ConnectionInterface $connection) : \Phergie\Irc\Client\React\WriteStream
Returns a stream instance for sending events to the server.
\Phergie\Irc\ConnectionInterface | $connection | Connection
|
getReadCallback(\Phergie\Irc\Client\React\WriteStream $write, \Phergie\Irc\ConnectionInterface $connection) : callable
Returns a callback for proxying IRC events from the read stream to IRC listeners of the client.
\Phergie\Irc\Client\React\WriteStream | $write | Write stream
|
\Phergie\Irc\ConnectionInterface | $connection | Connection on
|
getWriteCallback(\Phergie\Irc\Client\React\WriteStream $write, \Phergie\Irc\ConnectionInterface $connection) : callable
Returns a callback for proxying events from the write stream to IRC listeners of the client.
\Phergie\Irc\Client\React\WriteStream | $write | Write stream
|
\Phergie\Irc\ConnectionInterface | $connection | Connection on which
|
getErrorCallback(\Phergie\Irc\ConnectionInterface $connection) : callable
Returns a callback for proxying connection error events to listeners of the client.
\Phergie\Irc\ConnectionInterface | $connection | Connection on which
|
getEndCallback(\React\Stream\DuplexStreamInterface $stream, \Phergie\Irc\ConnectionInterface $connection, \React\EventLoop\Timer\TimerInterface $timer) : callable
Returns a callback for when a connection is terminated, whether explicitly by the bot or server or as a result of loss of connectivity.
\React\Stream\DuplexStreamInterface | $stream | Stream representing the
|
\Phergie\Irc\ConnectionInterface | $connection | Terminated connection |
\React\EventLoop\Timer\TimerInterface | $timer | Timer used to handle
|
getTickCallback(\Phergie\Irc\Client\React\WriteStream $write, \Phergie\Irc\ConnectionInterface $connection)
Returns a callback executed periodically to allow events to be sent asynchronously versus in response to received or sent events.
\Phergie\Irc\Client\React\WriteStream | $write | Stream used to
|
\Phergie\Irc\ConnectionInterface | $connection | Connection to
|
configureStreams(\Phergie\Irc\ConnectionInterface $connection, \React\Stream\DuplexStreamInterface $stream, \Phergie\Irc\Client\React\WriteStream $write)
Configure streams to handle messages received from and sent to the server.
\Phergie\Irc\ConnectionInterface | $connection | Metadata for the
|
\React\Stream\DuplexStreamInterface | $stream | Stream representing the
|
\Phergie\Irc\Client\React\WriteStream | $write | Stream used to
|
identifyUser(\Phergie\Irc\ConnectionInterface $connection, \Phergie\Irc\Client\React\WriteStream $writeStream)
Identifies the user to a server.
\Phergie\Irc\ConnectionInterface | $connection | Connection on which
|
\Phergie\Irc\Client\React\WriteStream | $writeStream | Stream to
|
emitConnectionError(\Exception $exception, \Phergie\Irc\ConnectionInterface $connection)
Emits a connection error event.
\Exception | $exception | |
\Phergie\Irc\ConnectionInterface | $connection |
addUnsecuredConnection(\Phergie\Irc\ConnectionInterface $connection)
Initializes an unsecured connection.
\Phergie\Irc\ConnectionInterface | $connection |
getSecureConnector() : \React\SocketClient\SecureConnector
Returns a connector for establishing SSL connections.
addSecureConnection(\Phergie\Irc\ConnectionInterface $connection)
Initializes a secured connection.
\Phergie\Irc\ConnectionInterface | $connection |
if the SSL transport and
forcing IPv4 usage are both enabled
initializeStream(\React\Stream\DuplexStreamInterface $stream, \Phergie\Irc\ConnectionInterface $connection)
Configures an established stream for a given connection.
\React\Stream\DuplexStreamInterface | $stream | |
\Phergie\Irc\ConnectionInterface | $connection |
initializeConnection(string $remote, \Phergie\Irc\ConnectionInterface $connection)
Initializes an added connection.
string | $remote | |
\Phergie\Irc\ConnectionInterface | $connection |