JMeter WebSocket plugin - Close SignalR connection

杀马特。学长 韩版系。学妹 提交于 2019-12-24 19:29:04

问题


I've a website using Asp.NET Core SignalR to dynamically load data from the server.

I use JMeter to do functional tests on this page. I use the WebSocket sampler plugin in version 1.2.1 to test the SignalR functionality.

Following this blazemeter tutorial on how to use JMeter with the WebSocket sampler plugin I get always an error when trying to close the SignalR connection.

My JMeter sampler setup looks like:

  1. WebSocket Open Connection
  2. WebSocket request-response Sampler
  3. WebSocket Single Read Sampler
  4. WebSocket Close

For closing the connection I use the WebSocket sampler called WebSocket Close. This sampler allows to provide a Close status.

I've tried to provide different Close status codes. But non of the provided codes actually got confirmed and always the error message was returned:

Response code: WebSocket error: unsuccesful close.

Response message: WebSocket error: received not a close frame, but Text frame with text ...

How can I properly close this connection in JMeter?


Update

I've figured out that it depends on how many samplers I use. If I use a write sampler before the read sampler the close seems to work. Like:

  1. WebSocket Open Connection
  2. WebSocket request-response Sampler
  3. WebSocket Single Read Sampler
  4. WebSocket Single Write Sampler
  5. WebSocket Close

But if I want to have more then one read sampler it doesn't work. Any idea how I properly use multiple read sampler?


Update 2

I've re-read the Plugins documentation and also checked the sample JMeter files here. Unfortunately I haven't found a bigger sample with multiple Read Samplers so far.


回答1:


What probably is happening is that your server has sent some text messages that your JMeter test script hasn't read. These messages are buffered and when you close the WebSocket connection, the "Close Sampler" first reads one of those text messages and returns an error.

There is a change request for enhancing the "Close Sampler" with an option to ignore such bufferend messages. For the time being, you can achieve the same by combining a text frame filter with the close sampler; see the "Smart close with filter sample.jmx" sample in the samples directory.



来源:https://stackoverflow.com/questions/53865947/jmeter-websocket-plugin-close-signalr-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!