3

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.

Community
  • 1
  • 1
Bruno Bieri
  • 9,724
  • 11
  • 63
  • 92
  • Hi Sir, Could you let me know which signalr version are you using and in which .net version? I was trying to read a message in jmeter from my asp.net core signalr server and couldn't get any message,even though messages are getting received in the browser client correctly so cant find what I am doing wrong. I am able to start websocket connection and using write sampler write messages to the server through the socket but only can detect the ping messages from the signalr server (using single read sampler) and no text frames are getting detected. Could you please help me out – Amrutha Jan 09 '19 at 05:20
  • I used the developer tools of the browser to understand what the website sends and recieves. With this I could build the JMeter test I wanted. – Bruno Bieri Jan 09 '19 at 13:02
  • Did you receive any text frame from your server to jmeter client using Single Read Sampler? I inspected the network traffic to the jmeter client and browser client using fiddler and found that the text frames sent by the server didnot reach the jmeter client but reached browser clients. I am sending the signalr connectionId in the url for subsequent write to servers.Am I missing any thing other than connectionId that is needed? Could you share your jmx file if its okay with you (the websocket sampler part) else what steps di u take to establish signalr connection and to read from it? – Amrutha Jan 09 '19 at 14:03
  • Please create your own Stackoverflow question. I think we shouldn't missuse the comments to solve your problem. Once you created your question let me know and I can try to help you there. – Bruno Bieri Jan 09 '19 at 14:42
  • https://stackoverflow.com/questions/54122668/cannot-read-text-from-net-core-signalr-server-using-single-read-sampler-in-jmet Here is the question posted as you suggested – Amrutha Jan 10 '19 at 06:01

1 Answers1

3

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.

Peter
  • 725
  • 4
  • 13