title: K6 WebSockets Loadtest Report Confusing
body: <p>Just wanna ask, how to read the report generated by K6 on websockets load test</p>
  <p><a href="https://i.stack.imgur.com/KRKM5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KRKM5.png" alt="enter image description here" /></a></p>
  <p>That's the report I got from the code i made like this</p>
  <pre><code>import {
    check,
    fail,
    sleep
  } from &quot;k6&quot;;
  import {
    Counter,
    Rate
  } from &quot;k6/metrics&quot;;
  import ws from &quot;k6/ws&quot;;
  
  let errorCount = new Counter(&quot;error_count&quot;);
  //let errorRate = new Rate(&quot;error_rate&quot;);
  
  
  export const options = {
    thresholds: {
      &quot;error_rate&quot;: [&quot;rate&lt;0.2&quot;]
    } // error rate not more than 20 percent
  };
  
  
  
  
  export default function () {
    
  
    var url = &quot;wss://play.blabla.com&quot;;
  
    console.log(url);
  
    var params = {
      headers: {
        &quot;accept-encoding&quot;: &quot;gzip, deflate&quot;,
        &quot;accept-language&quot;: &quot;id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7&quot;,
       
      }
    };
  
  
    let res;
  
    res = ws.connect(url, params, function(socket) {
      socket.on('open', function open() {
        console.log('connected');
  
        socket.setInterval(function timeout() {
          socket.ping();
          console.log(&quot;Pinging every 500 ms (setInterval test)&quot;);
        }, 500);
        });
  
        socket.on('ping', function () {
            console.log(&quot;PING!&quot;);
        });
  
        socket.on('pong', function () {
            console.log(&quot;PONG!&quot;);
        });
  
        socket.on('close', function() {
            console.log('disconnected');
        });
        
        socket.on('error', function(e) {
          if (e.error() != &quot;websocket: close sent&quot;) {
            console.log('An unexpected error occured: ', e.error());
          }
        });
  
    });
    
  
    let checking = check(res, { &quot;status is 101&quot;: r =&gt; r &amp;&amp; r.status === 101 });
  
    
  }
  </code></pre>
  <p>I dont understand on <code>ws_sessions</code> that hits 5603, but the <code>checks</code> said only 815</p>
  <p>Can someone explain? Is this report was having a good result or bad result from the test.</p>
  <p>Thanks a lot for your help guys!</p>