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
  1: <?php
  2: 
  3: namespace React\EventLoop;
  4: 
  5: use React\EventLoop\Timer\TimerInterface;
  6: 
  7: interface LoopInterface
  8: {
  9:     /**
 10:      * Register a listener to be notified when a stream is ready to read.
 11:      *
 12:      * @param resource $stream   The PHP stream resource to check.
 13:      * @param callable $listener Invoked when the stream is ready.
 14:      */
 15:     public function addReadStream($stream, callable $listener);
 16: 
 17:     /**
 18:      * Register a listener to be notified when a stream is ready to write.
 19:      *
 20:      * @param resource $stream   The PHP stream resource to check.
 21:      * @param callable $listener Invoked when the stream is ready.
 22:      */
 23:     public function addWriteStream($stream, callable $listener);
 24: 
 25:     /**
 26:      * Remove the read event listener for the given stream.
 27:      *
 28:      * @param resource $stream The PHP stream resource.
 29:      */
 30:     public function removeReadStream($stream);
 31: 
 32:     /**
 33:      * Remove the write event listener for the given stream.
 34:      *
 35:      * @param resource $stream The PHP stream resource.
 36:      */
 37:     public function removeWriteStream($stream);
 38: 
 39:     /**
 40:      * Remove all listeners for the given stream.
 41:      *
 42:      * @param resource $stream The PHP stream resource.
 43:      */
 44:     public function removeStream($stream);
 45: 
 46:     /**
 47:      * Enqueue a callback to be invoked once after the given interval.
 48:      *
 49:      * The execution order of timers scheduled to execute at the same time is
 50:      * not guaranteed.
 51:      *
 52:      * @param int|float $interval The number of seconds to wait before execution.
 53:      * @param callable  $callback The callback to invoke.
 54:      *
 55:      * @return TimerInterface
 56:      */
 57:     public function addTimer($interval, callable $callback);
 58: 
 59:     /**
 60:      * Enqueue a callback to be invoked repeatedly after the given interval.
 61:      *
 62:      * The execution order of timers scheduled to execute at the same time is
 63:      * not guaranteed.
 64:      *
 65:      * @param int|float $interval The number of seconds to wait before execution.
 66:      * @param callable  $callback The callback to invoke.
 67:      *
 68:      * @return TimerInterface
 69:      */
 70:     public function addPeriodicTimer($interval, callable $callback);
 71: 
 72:     /**
 73:      * Cancel a pending timer.
 74:      *
 75:      * @param TimerInterface $timer The timer to cancel.
 76:      */
 77:     public function cancelTimer(TimerInterface $timer);
 78: 
 79:     /**
 80:      * Check if a given timer is active.
 81:      *
 82:      * @param TimerInterface $timer The timer to check.
 83:      *
 84:      * @return boolean True if the timer is still enqueued for execution.
 85:      */
 86:     public function isTimerActive(TimerInterface $timer);
 87: 
 88:     /**
 89:      * Schedule a callback to be invoked on the next tick of the event loop.
 90:      *
 91:      * Callbacks are guaranteed to be executed in the order they are enqueued,
 92:      * before any timer or stream events.
 93:      *
 94:      * @param callable $listener The callback to invoke.
 95:      */
 96:     public function nextTick(callable $listener);
 97: 
 98:     /**
 99:      * Schedule a callback to be invoked on a future tick of the event loop.
100:      *
101:      * Callbacks are guaranteed to be executed in the order they are enqueued.
102:      *
103:      * @param callable $listener The callback to invoke.
104:      */
105:     public function futureTick(callable $listener);
106: 
107:     /**
108:      * Perform a single iteration of the event loop.
109:      */
110:     public function tick();
111: 
112:     /**
113:      * Run the event loop until there are no more tasks to perform.
114:      */
115:     public function run();
116: 
117:     /**
118:      * Instruct a running event loop to stop.
119:      */
120:     public function stop();
121: }
122: 
Ratchet API documentation generated by ApiGen 2.8.0