title: Artilary: Wait for an event to be emitted from a socket.io server
body: <p>I have a socket.io app with a flow that I would like to load test.</p>
  <p>The flow looks something like this:</p>
  <pre><code>start_session -&gt; server
  client &lt;- session_token
  client &lt;- session_ready
  </code></pre>
  <p>I would like for artillery to measure the time it takes the server to reply with that <code>session_ready</code> event.</p>
  <p>How can i do that?
  I have tried something like:</p>
  <pre><code>scenarios:
    - engine: socketio-v3 
      name: &quot;connect to session sockets&quot;
      flow:
        - emit: 
            channel: &quot;start_session&quot;
  
        - on: &quot;session_token&quot;      
          capture:
              json: &quot;$.sessionToken&quot;
              as: sessionToken
          log: &quot;session token is {{ sessionToken }} &quot;
  
        - on: &quot;session_ready&quot;      
          capture:
              json: &quot;$.connectKey&quot;
              as: connectKey
          log: &quot;connect key is {{ connectKey }} &quot;
  </code></pre>
  <p>But it doesn't seem to wait for the events to be emitted and just exists after emitting the first event.</p>