Error while trying to send the message over websocket connection in Jmeter | WebSocket Samplers by Peter Doornbosch - websocket

I am using a plugin (WebSocket Samplers by Peter Doornbosch) to establish the WebSocket connection in JMeter and trying to send the request message over it but receiving below error in logs
ERROR - eu.luminis.jmeter.wssampler.RequestResponseWebSocketSampler: Unexpected frame type received in sampler 'WebSocket request-response Sampler': Close frame with status code null and close reason 'null'
My test plan consists of "WebSocket Open Connection", "Web-socket request-response sampler" and "web-socket ping/pong frame filter". And I feel there is no issue in establishing the connection but something is wrong while sending the request or receiving a response.
Also, tried checking the logs from the server but didn't find any requests which were sent using JMeter.
Implemented another available plugin too in Jmeter to test the WebSocket but seeing similar behavior. Any help would be highly appreciated.

It looks like you're using the wrong sampler type, looking into the error you're getting it makes more sense to use single-write sampler which is designed for sending one (text or binary) WebSocket frame.
You might want to use a sniffer tool like Fiddler or Wireshark to capture the traffic between your browser (or application) and the backend and see what types of frames are going, which direction, is single connection re-used or each time new one is established, etc.
You may also find the following links useful:
Example scripts collection
JMeter WebSocket Samplers - A Practical Guide

The problem is that your server is actively closing the connection. Usually, this is caused by the client sending a request that the server does not understand. In your case, it's very likely that the request you are sending in the request-response sampler is not accepted by the server. As Dmitri suggests, the best way to find out how a "normal" client communicates with the server is to capture a session with WireShark and model your testplan accordingly.
Hth.

Related

Unable to execute Websocket in jmeter but the same stuff is working fine in postman

The websocket in Postman is immediately connected below, producing a room and a socket.
wss:/service.com/?token=POTE117771
However, the outcome of the websocket added plugins in JMeter is 0"sid":"UME84d0DoF9N3tDCAABQ","upgrades":[],"pingInterval":25000,"pingTimeout":20000,"maxPayload":1000000.
However, no rooms or scokets are made.
It should be connected for jmeter to send requests. kindly assist me
We are not telepathic enough to "assist" you without seeing your Postman and JMeter configuration, which exact plugin you're using:
JMeter-WebSocketSampler by Maciej Zaleski
or JMeter WebSocket Samplers by Peter Doornbosch
But one thing is obvious: if you send the same request (or in case of WebSockets it might be a sequence of requests) you will get the same response so make sure that JMeter is sending the same request as Postman does (apart from dynamic parts which need to be correlated) the request from JMeter will "produce room and socket" (whatever it is)

Which is the best sampler from Jmeter for creating Websocket connection as that request contains Bearer token as well in request payload

Our Application is live event based application which creates 2-3 web-socket connection and it is a web-based application which makes both HTTP calls and Web-socket calls.
I have created a script for Https calls as unfortunately Jmeter does not support web-socket recording so I trying to insert web-socket calls manually with the help of web-socket Sampler but not sure which will be the best sampler for same as my request has access token in it.
I tried with Web-socket request-response sampler I am getting 200 OK but their is no data response from server when I compare it with browser developer tool i could see some messages flowing..
Can anyone let me know if I am doing something wrong or missing anything? OR what can be done to solve it.
I believe JMeter WebSocket Samplers by Peter Doornbosch is what you're looking for.
As per Features section:
integrates with JMeter's Header Manager to set additional HTTP headers on WebScoket upgrade request
so you will be able to add HTTP Header Manager, configure it to send Authorization header with the value of Bearer followed by your token and the Sampler will pick it up.
With regards to which one to choose - it depends on the nature of your application and how does the communication with the backend looks like, check out your browser developer tools to see whether requests/and responses are coming via a single connection or a new one is being established for each frame and so on.
More information: JMeter WebSocket Samplers - A Practical Guide

How to capture Multiple response for a same request in Jmeter

I am initiating the request from Jmeter using HTTP Request Sampler. In the body data i am sending the request and the application server sends back two different responses for the same request. After receiving the first response, Jmeter will close the request and in my scenario i need to capture the second response also. Kindy share your ideas on this.
Regards,
Chandru
Which protocol? In case of HTTP this is exactly how it supposed to work: one request -> one response, you can keep the underlying TCP connection alive so JMeter would re-use the connection for sending the next request, but HTTP Request sampler won't expect any additional responses.
In case of Server Side Events you will need to do some scripting in order to handle the situation like it's described in How to Load Test SSE Services with JMeter article
In case of WebSockets take a look at Read continuation frames.jmx example test plan

What does jmeter do if no response is received?

i send 10 requests to the server which was recorded by blazemeter chrome plugin.
some of them are signalr requests that have connection token values created runtime.
signalr requests are
signalr/negotiate?..
signalr/connect?
signalr/start?
signalr/abort?
if i dont use regular expression extractor for correlation, the signalr request has wrong responses and test will fail.
if i use correlation, some interesting results are present.
if i use it only in signalr/start it will pass, the other signalr's will fail.
if i add the connectionParameter to the signalr/connect... request. it will do nothing and test will not continue and not finished. So, i wonder if Jmeter dont send the request or any response is received. in view result tree listener, the request is not seen in this case.
What will Jmeter do if a response is not send by server?
or any other information that i dont know related to signalr/connect.. issue?
What will Jmeter do if a response is not send by server
When it comes to HTTP Request samplers JMeter will wait for response for the time defined in the "Timeouts" section of the aforementioned HTTP Request sampler
Blank values mean "no timeout" so JMeter will wait either forever or until the socket timeout defined in the underlying JVM or OS is exceeded.
With regards to SignalR most probably you need to use WebSocket Samplers plugin, I don't think there is a way to record these requests using whatever JMeter recording solution currently available in the market so consider inspecting the traffic from your browser to the backend using either browser developer tools or a 3rd-party sniffer tool like Wireshark.

How can I check out the server's response of unexpected frame type (ping)

During I use the Jmeter Websocket request-response Sampler plugin to do the load test, the server returns the following errors:
(1)Sampler error: unexpected frame type (ping).
(2)Ping frame with application data 'T悅o'
But how can I check out the error and find the solution to the problems, thanks for your help:
Responses from the WebSocket server
You can add WebSocket Ping/Pong Frame Filter to your Test Plan and it will automatically discard Ping and/or Pong frames so you should stop seeing this error.
More information:
JMeter WebSocket Samplers documentation (look for Filters)
JMeter WebSocket Samplers - A Practical Guide

Resources