title: JMeter ignore specific types of responses in all Receive samplers (Websocket)
body: <p>Is there a way for all Receive samplers to ignore specific responses in <strong>JMeter</strong> and wait for the one that we are interested?</p>
  <p>To be more precise, we have created a jmx file that contains a large flow like a user would create on the browser. Each request sent is followed by a response, so we use a request handler followed by the corresponding receive handler for each call. And everything seems to work fine.
  But there are cases that another kind of response may arrive, which is not the one we expect in our flow, but it is triggered by another independent mechanism. You can think of it like notifications sent to the user that is doing the flow and are independent of the flow itself, but theu are received in the channel (for us inside the websocket connection).</p>
  <p>So we are trying to find a way to ignore a specific set of responses that may come while we are running the tests.</p>
  <p>We firstly tried to add a While Controller in each receive sampler that checks if the content is of the desired type and if not loops again. But this solution has 3 disadvantages :</p>
  <ol>
  <li>we have to add the sampler for the specific receive twice - one before the while element and one inside the element because we have to first extract the received data and while does not execute its contents before doing the while condition check</li>
  <li>we have so many pairs of send-receive in our jmeter test script , that we have to add so many while controllers inside the script</li>
  <li>since the received message may not be of the type we expect but another one that we want to ignore, then we cannot add a Response Assertion because it will fail if the notification arrives, so we have to verify the content indirect -&gt; in the condition of the while loop</li>
  </ol>
  <p>We use <strong>apache-jmeter-5.3</strong>.</p>
  <p>So we are wondering if we could do another kind of configuration in order to avoid all these while loops.</p>
  <p>It may be irrelevant to the solution, but we use websocket through &quot;WebSocket Samplers by Peter Doornbosch&quot;.</p>
  <p>Thanks</p>