Sending data to Jmeter with Websocket - jmeter

Can anyone with experience with Jmeter tell how to send data to Application after successfully creation of web socket?

The fastest and the easiest way is using WebSocket Sampler
See WebSocket Testing With Apache JMeter article for detailed information on using the WebSocket Sampler and alternative options of implementing WebSocket testing using JMeter.

Related

Apache JMeter Test Script Recorder gRPC HTTP/2 support

I want to load test a web application server which communicates through gRPC (which uses HTTP/2 for transport) with the clients.
It seems that Apache JMeter extended by the plugin JMeter gRPC Plugin and JMeter gRPC Request sampler would be perfect for this.
Among other things JMeter provides a Test Script Recorder which helps quickly generate scenarios by acting as a HTTP proxy between the client and the server.
Question 1: Is it possible to use the JMeter Recorder for recording the communication through the gRPC protocol?
Question 2: Is it possible to use the JMeter Recorder for recording the communication through the underlying HTTP/2 protocol?
I have tried already the JMeter Recorder to record the gRPC communication without success :-( Maybe caused by wrong configuration of the recorder?
No, at least not with JMeter 5.5
No, as of JMeter 5.5 the HTTP(S) Test Script Recorder doesn't support HTTP/2. Neither it does support .proto files so even if you record the raw packets you won't be able to decode them into anything meaningful
So I would recommend using a sniffer tool like Wireshark for capturing the packets between client and the system under test and then replicating the same using JMeter's GRPC sampler.

Multiple Parallel Websocket connections to SignalR hub in JMeter

We are trying to load test our login workflow, by simulating 50+ users logging into our front-end, via the API calls. As part of the login process, we make a websocket connection to a SignalR hub(Connect). We then send a call over the websocket connection to a custom endpoint in SignalR(Login), used to add some data to the Redis cache, then do some stuff which isn't important, then send a call to a different custom endpoint over the websocket connection(Logoff) and then Disconnect the websocket connection.
So my question is multi-part:
How do we create a websocket connection from within JMeter?
How do we make a call to a custom endpoint over the websocket connection in JMeter
How do we do this for multi users simulated to be running in parallel, so we can test the load? In other words, we need multiple websocket connections open / alive from JMeter so we can test the load.
Note: Please be aware, I'm asking this on behalf of the load tester/JMeter developer, but because they are new to Stack Overflow, and I understand the SignalR side, I've been asked to log it. I know zip about JMeter, so please handle me like a noob trying to help someone solve a frustrating but important problem.
JMeter per se doesn't support WebSockets, you will need a special plugin if you want to enable this functionality.
The most advanced, comprehensive and supported as of now is JMeter WebSocket Samplers by Peter Doornbosch, it can be installed using JMeter Plugins Manager
Once you install the plugin and restart JMeter you will see several new samplers which will allow to open connection, send request, read response, and close connection.
Unfortunately I cannot guide you further because I don't know the specifics of your application, just look into your browser developer tools or other sniffer tool and configure JMeter to send the same requests as your browser (or other application) does.
More information:
Test SignalR Performance with JMeter
JMeter WebSocket Samplers - A Practical Guide
samples directory contains several example test plans covering different scenarios

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

SignalR does not connect when i record it with JMeter

Hi I am doing performance testing over a application but i cannot replicate the signalR connection what i do is call to the negociate api
/signalr/negociate getting the response as expected with the connection token
"Url":"/MyApp/signalr","ConnectionToken":"gM8NUnZtDg6oYU3Y9sfZgnIDlInyvspePwDuRdmqZlslRgkPIp8w/c0FZzllhwiUdZlOmPkyBd2DGU76ldt3v1B25lQlTeg1jETBWRkqaXD0QGpeNJLl3KqvnJ3v4YQ2","ConnectionId":"e1adc41d-ad0d-439f-858c-1fa47bb59083","KeepAliveTimeout":20.0,"DisconnectTimeout":30.0,"ConnectionTimeout":110.0,"TryWebSockets":true,"ProtocolVersion":"1.5","TransportConnectTimeout":5.0,"LongPollDelay":0.0}
Then i extract with JMeter that token (and i use it into the connect call)
GET https://myHost/myApp/signalr/connect?transport=webSockets&clientProtocol=1.5&connectionToken=gM8NUnZtDg6oYU3Y9sfZgnIDlInyvspePwDuRdmqZlslRgkPIp8w%2Fc0FZzllhwiUdZlOmPkyBd2DGU76ldt3v1B25lQlTeg1jETBWRkqaXD0QGpeNJLl3KqvnJ3v4YQ2&connectionData=%5B%7B%22name%22%3A%22workhub%22%7D%5D&tid=2
But the response is always a 400 Bad Request
Not a valid web socket request.
Any idea why that call fail?
Thank you very much
I don't think you can record WebSocket requests using JMeter's HTTP(S) Test Script Recorder as the aforementioned HTTP(S) Test Script Recorder is only capable of generating HTTP Request samplers as of JMeter 5.2
I would recommend using one of the following approaches for capturing outgoing WebSocket requests:
Browser developer tools (network tab should have WebSocket traffic filtering option)
Fiddler
Wireshark
Once done you can install JMeter WebSocket Samplers plugin and use the appropriate Samplers to simulate the WebSocket requests, you will need to manually set up the payload.

JMeter recording use non http/https protocol

I am recording our game app using JMeter
And it has an API server, which using the WebSocket's protocol
While meeting that request sent to API server, I always get this message, and can't go further
Is that means I need to modify the original JMeter's source code to walk around this problem? Or any way out? If so, that'd be appreciated.
I don't think you will be able to record and replay WebSocket transport using JMeter's HTTP(S) Test Script Recorder as WebSocket is a different beast, given you have a game application my expectation is that it might be the case application opens a WebSocket connection and re-uses it until the end of session and so you won't be able to mimic this behavior using "normal" HTTP Request samplers as WebSocket assumes either ws or wss protocol.
I would suggest considering one of the following JMeter Plugins:
WebSocket Sampler by Maciej Zaleski
WebSocket Samplers by Peter Doornbosch
Both plugins can be installed using JMeter Plugins Manager:

Resources