<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.swoole.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'es',
  ),
  'this' => 
  array (
    0 => 'class.swoole-event.php',
    1 => 'Swoole\\Event',
    2 => 'La clase Swoole\\Event',
  ),
  'up' => 
  array (
    0 => 'book.swoole.php',
    1 => 'Swoole',
  ),
  'prev' => 
  array (
    0 => 'swoole-coroutine-lock.unlock.php',
    1 => 'Swoole\\Coroutine\\Lock::unlock',
  ),
  'next' => 
  array (
    0 => 'swoole-event.add.php',
    1 => 'Swoole\\Event::add',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'es',
    'path' => 'reference/swoole/swoole.event.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/class.swoole-event.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="class.swoole-event" class="reference">

 <h1 class="title">La clase Swoole\Event</h1>
 

 <div class="partintro"><p class="verinfo">(PECL swoole &gt;= 1.9.0)</p>


  <div class="section" id="swoole-event.intro">
   <h2 class="title">Introducción</h2>
   <p class="simpara">
    La extensión Swoole proporciona interfaces de bajo nivel para manipular directamente
    el bucle de eventos subyacente epoll/kqueue/poll/select.
    Permite añadir al EventLoop de Swoole sockets creados por otras extensiones
    o por las extensiones stream/socket de PHP.
   </p>
   <blockquote class="note"><p><strong class="note">Nota</strong>: 
    <p class="simpara">
     El módulo Event es de bajo nivel, ya que es un encapsulamiento básico de epoll.
     Los usuarios deberían tener experiencia en programación con multiplexación de E/S.
    </p>
   </p></blockquote>
  </div>


  <div class="section" id="swoole-event.event-priority">
   <h2 class="title">Prioridad de los eventos</h2>
   <ol type="1">
    <li class="listitem"><p class="simpara">Funciones de retrollamada de manejo de señales definidas mediante Process::signal</p></li>
    <li class="listitem"><p class="simpara">Funciones de retrollamada de temporizador definidas mediante Timer::tick y Timer::after</p></li>
    <li class="listitem"><p class="simpara">Funciones de ejecución diferida definidas mediante Event::defer</p></li>
    <li class="listitem"><p class="simpara">Funciones de retrollamada periódicas definidas mediante Event::cycle</p></li>
   </ol>
  </div>

  <div class="section" id="swoole-event.event-socket">
   <h2 class="title">Tipo de socket de eventos de Swoole</h2>
   <p class="para">
    <dl>
     
      <dt id="swoole-event.int">
       <code class="parameter">fd</code>
       <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      </dt>
      <dd>
       <p class="simpara">
        Descriptores de fichero, incluyendo Swoole\Client-&gt;$sock, Swoole\Process-&gt;$pipe,
        o cualquier otro descriptor de fichero (fd).
       </p>
      </dd>
     
     
      <dt id="swoole-event.stream">
       <code class="parameter">stream resource</code>
       <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>
      </dt>
      <dd>
       <p class="simpara">
        Recursos creados por stream_socket_client/fsockopen.
       </p>
      </dd>
     
     
      <dt id="swoole-event.socket">
       <code class="parameter">socket resource</code>
       <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>
      </dt>
      <dd>
       <p class="simpara">
        Los recursos creados por socket_create de la extensión sockets requieren
        la opción --enable-sockets durante la compilación de Swoole.
       </p>
      </dd>
     
     
      <dt id="swoole-event.object">
       <code class="parameter">object</code>
       <span class="type"><a href="language.types.object.php" class="type object">object</a></span>
      </dt>
      <dd>
       <p class="simpara">
        Swoole convierte automáticamente Swoole\Process en un UnixSocket y Swoole\Client
        en un socket cliente conectado a bajo nivel.
       </p>
      </dd>
     
    </dl>
   </p>
  </div>

  <div class="section" id="swoole-event.synopsis">
   <h2 class="title">Sinopsis de la clase</h2>


   <div class="classsynopsis">
    <span class="ooclass"><strong class="classname"></strong></span>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">Swoole\Event</strong>
     </span>
     {</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Métodos */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="modifier">function</span> <span class="methodname"><a href="swoole-event.add.php" class="methodname">add</a></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$sock</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$read_callback</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$write_callback</code><span class="initializer"> = ?</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$flags</code><span class="initializer"> = ?</span></span><br>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="modifier">static</span> <span class="modifier">function</span> <span class="methodname"><a href="swoole-event.cycle.php" class="methodname">cycle</a></span>(<span class="methodparam"><span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$callback</code></span>, <span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$before</code><span class="initializer"> = false</span></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="modifier">static</span> <span class="modifier">function</span> <span class="methodname"><a href="swoole-event.defer.php" class="methodname">defer</a></span>(<span class="methodparam"><span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$callback_function</code></span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="modifier">static</span> <span class="modifier">function</span> <span class="methodname"><a href="swoole-event.del.php" class="methodname">del</a></span>(<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$sock</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="modifier">static</span> <span class="modifier">function</span> <span class="methodname"><a href="swoole-event.dispatch.php" class="methodname">dispatch</a></span>(): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>  <span class="modifier">static</span> <span class="modifier">function</span> <span class="methodname"><a href="swoole-event.isset.php" class="methodname">isset</a></span>(<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$fd</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$events</code>
    <span class="initializer"> = 
     SWOOLE_EVENT_READ | SWOOLE_EVENT_WRITE
    </span>
   </span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="modifier">static</span> <span class="modifier">function</span> <span class="methodname"><a href="swoole-event.set.php" class="methodname">set</a></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$sock</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$read_callback</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$write_callback</code><span class="initializer"> = ?</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$flags</code><span class="initializer"> = ?</span></span><br>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="modifier">static</span> <span class="modifier">function</span> <span class="methodname"><a href="swoole-event.wait.php" class="methodname">wait</a></span>(): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="modifier">static</span> <span class="modifier">function</span> <span class="methodname"><a href="swoole-event.write.php" class="methodname">write</a></span>(<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$fd</code></span>, <span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$data</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

   }</div>


  </div>

 </div>

 




























































<h2>Tabla de contenidos</h2><ul class="chunklist chunklist_reference"><li><a href="swoole-event.add.php">Swoole\Event::add</a> — A&ntilde;ade un socket al escuchador de eventos del reactor subyacente</li><li><a href="swoole-event.cycle.php">Swoole\Event::cycle</a> — Define a function to execute at the end of each event loop iteration</li><li><a href="swoole-event.defer.php">Swoole\Event::defer</a> — Ejecuta una funci&oacute;n al inicio de la pr&oacute;xima iteraci&oacute;n del bucle de eventos</li><li><a href="swoole-event.del.php">Swoole\Event::del</a> — Elimina un socket del escuchador de eventos del reactor</li><li><a href="swoole-event.dispatch.php">Swoole\Event::dispatch</a> — Perform a single event loop iteration</li><li><a href="swoole-event.isset.php">Swoole\Event::isset</a> — Check if a socket is being monitored in the event loop</li><li><a href="swoole-event.set.php">Swoole\Event::set</a> — Modifica las funciones de retrollamada y la m&aacute;scara de eventos</li><li><a href="swoole-event.wait.php">Swoole\Event::wait</a> — Inicia el bucle de eventos</li><li><a href="swoole-event.write.php">Swoole\Event::write</a> — Escribe datos en un socket de forma as&iacute;ncrona</li></ul>
</div>
<?php manual_footer($setup); ?>