Search code examples
jmeterjmeter-pluginsjmeter-5.0

JMeter (Sampler 'WebSocket Single Read Sampler': there is no connection to re-use)


I have problem. I use Jmeter for test site, and after open connection after write/read samplers, after ~40 sec my socket closed and test stops. I can every 40 sec open connection or else?

Screenshot
enter image description here


Solution

  • You have 2 options:

    1. First open a WebSocket Connection by executing WebSocket Open Connection and then tick use existing connection box in the WebSocket Single Read Sampler

      enter image description here

    2. Or alternatively you can open a new connection each time you execute the WebSocket Single Read Sampler

      enter image description here

    If the client you're trying to simulate opens a single connection and then executes multiple reads - you should go for option 1 and vice versa.

    If the connection gets broken in the middle somewhere somehow you need to find a reason for this, i.e. enable debug logging for WebSocket Samplers by adding the next line to log4j2.xml file:

    <Logger name="eu.luminis" level="debug" />
    

    and inspect jmeter.log file for any suspicious entries