Overview

Namespaces

  • Evenement
  • None
  • PHP
  • Psr
    • Http
      • Message
  • Ratchet
    • Http
    • RFC6455
      • Handshake
      • Messaging
    • Server
    • Session
      • Serialize
      • Storage
        • Proxy
    • Wamp
    • WebSocket
  • React
    • EventLoop
      • Tick
      • Timer
    • Socket
    • Stream
  • Symfony
    • Component
      • HttpFoundation
        • Session
          • Attribute
          • Flash
          • Storage
            • Handler
            • Proxy
      • Routing
        • Annotation
        • Exception
        • Generator
          • Dumper
        • Loader
          • DependencyInjection
        • Matcher
          • Dumper
        • Tests
          • Annotation
          • Fixtures
            • AnnotatedClasses
            • OtherAnnotatedClasses
          • Generator
            • Dumper
          • Loader
          • Matcher
            • Dumper

Classes

  • ExtEventLoop
  • Factory
  • LibEventLoop
  • LibEvLoop
  • StreamSelectLoop

Interfaces

  • LoopInterface
  • Overview
  • Namespace
  • Class
  • Tree

Class StreamSelectLoop

A stream_select() based event-loop.

React\EventLoop\StreamSelectLoop implements React\EventLoop\LoopInterface
Namespace: React\EventLoop
Located at StreamSelectLoop.php
Methods summary
public
# __construct( )
public
# addReadStream( resource $stream, callable $listener )

Register a listener to be notified when a stream is ready to read.

Register a listener to be notified when a stream is ready to read.

Parameters

$stream
resource
$stream The PHP stream resource to check.
$listener
callable
$listener Invoked when the stream is ready.

Implementation of

React\EventLoop\LoopInterface::addReadStream()
public
# addWriteStream( resource $stream, callable $listener )

Register a listener to be notified when a stream is ready to write.

Register a listener to be notified when a stream is ready to write.

Parameters

$stream
resource
$stream The PHP stream resource to check.
$listener
callable
$listener Invoked when the stream is ready.

Implementation of

React\EventLoop\LoopInterface::addWriteStream()
public
# removeReadStream( resource $stream )

Remove the read event listener for the given stream.

Remove the read event listener for the given stream.

Parameters

$stream
resource
$stream The PHP stream resource.

Implementation of

React\EventLoop\LoopInterface::removeReadStream()
public
# removeWriteStream( resource $stream )

Remove the write event listener for the given stream.

Remove the write event listener for the given stream.

Parameters

$stream
resource
$stream The PHP stream resource.

Implementation of

React\EventLoop\LoopInterface::removeWriteStream()
public
# removeStream( resource $stream )

Remove all listeners for the given stream.

Remove all listeners for the given stream.

Parameters

$stream
resource
$stream The PHP stream resource.

Implementation of

React\EventLoop\LoopInterface::removeStream()
public React\EventLoop\Timer\TimerInterface
# addTimer( integer|float $interval, callable $callback )

Enqueue a callback to be invoked once after the given interval.

Enqueue a callback to be invoked once after the given interval.

Parameters

$interval
integer|float
$interval The number of seconds to wait before execution.
$callback
callable
$callback The callback to invoke.

Returns

React\EventLoop\Timer\TimerInterface

Implementation of

React\EventLoop\LoopInterface::addTimer()
public React\EventLoop\Timer\TimerInterface
# addPeriodicTimer( integer|float $interval, callable $callback )

Enqueue a callback to be invoked repeatedly after the given interval.

Enqueue a callback to be invoked repeatedly after the given interval.

Parameters

$interval
integer|float
$interval The number of seconds to wait before execution.
$callback
callable
$callback The callback to invoke.

Returns

React\EventLoop\Timer\TimerInterface

Implementation of

React\EventLoop\LoopInterface::addPeriodicTimer()
public
# cancelTimer( React\EventLoop\Timer\TimerInterface $timer )

Cancel a pending timer.

Cancel a pending timer.

Parameters

$timer
React\EventLoop\Timer\TimerInterface
$timer The timer to cancel.

Implementation of

React\EventLoop\LoopInterface::cancelTimer()
public boolean
# isTimerActive( React\EventLoop\Timer\TimerInterface $timer )

Check if a given timer is active.

Check if a given timer is active.

Parameters

$timer
React\EventLoop\Timer\TimerInterface
$timer The timer to check.

Returns

boolean
True if the timer is still enqueued for execution.

Implementation of

React\EventLoop\LoopInterface::isTimerActive()
public
# nextTick( callable $listener )

Schedule a callback to be invoked on the next tick of the event loop.

Schedule a callback to be invoked on the next tick of the event loop.

Parameters

$listener
callable
$listener The callback to invoke.

Implementation of

React\EventLoop\LoopInterface::nextTick()
public
# futureTick( callable $listener )

Schedule a callback to be invoked on a future tick of the event loop.

Schedule a callback to be invoked on a future tick of the event loop.

Parameters

$listener
callable
$listener The callback to invoke.

Implementation of

React\EventLoop\LoopInterface::futureTick()
public
# tick( )

Perform a single iteration of the event loop.

Perform a single iteration of the event loop.

Implementation of

React\EventLoop\LoopInterface::tick()
public
# run( )

Run the event loop until there are no more tasks to perform.

Run the event loop until there are no more tasks to perform.

Implementation of

React\EventLoop\LoopInterface::run()
public
# stop( )

Instruct a running event loop to stop.

Instruct a running event loop to stop.

Implementation of

React\EventLoop\LoopInterface::stop()
protected integer|false
# streamSelect( array & $read, array & $write, integer|null $timeout )

Emulate a stream_select() implementation that does not break when passed empty stream arrays.

Emulate a stream_select() implementation that does not break when passed empty stream arrays.

Parameters

$read
array
&$read An array of read streams to select upon.
$write
array
&$write An array of write streams to select upon.
$timeout
integer|null
$timeout Activity timeout in microseconds, or null to wait forever.

Returns

integer|false
The total number of streams that are ready for read/write. Can return false if stream_select() is interrupted by a signal.
Constants summary
integer MICROSECONDS_PER_SECOND 1000000
#
Ratchet API documentation generated by ApiGen 2.8.0