Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • Thanks for answering the query. Please can you clear some of my doubts: I am trying to load test a scenario where the client is continuously listening to WebSocket. 1 Using a jar file I am able to continuously stream the data when I hit the java jar in the terminal. I can see the data flowing 2. Now I try to replicate the scenario in JMeter, the sampler acts like a request/response, where the connection is lost after the response. 3. Now if I set a loop in JMeter, it does not satisfy the purpose of streaming. It will act as multiple requests sent to the same channel. Commented Apr 29, 2017 at 15:23
  • You should not use the request-response sampler, but the "WebSocket Single Read Sampler". It reads one websocket frame, no more, no less (websocket protocol is frame based). So if you put "Single Read Sampler" in a loop, you're effectively only reading frames, so that should match your requirement to read a stream of data... Commented Apr 29, 2017 at 20:21
  • This sampler does not loose the connection, it keeps it for re-use by the same JMeter thread. Set up the connection with the "WebSocket Open Connection" sampler, before the loop and check the "use existing connection" option in the "Single Read Sampler". Commented Apr 29, 2017 at 20:30
  • Moreover, from your answer, i guess that you are using the WebSocket Sampler from Maciej Zaleski's plugin; that might cause the confusion. Use the sampler that is (exactly) called: "WebSocket Single Read Sampler". Hth. Commented Apr 29, 2017 at 20:31
  • Thank you!! I have used the samplers you mentioned and designed the load script as you mentioned. It's working properly, and also thanks for the giving an overview of websocket. Commented May 2, 2017 at 8:26