Jmeter Websocket Test details, jmeterwebsocket
1. Websocket is a persistent connection. First, a connection is established through the http protocol.
The websocket protocol continuously interacts with the server, and the protocol is passive, so the server can take the initiative
The following figure shows the specific packet capture status of the notification client. After Websocket connection, it can be seen that a request is sent to the server.
No need to establish an http connection again
1. analyze the differences between Websocket and http at the interface layer.
Headers: Upgrade and Connection indicate the request type. The Sec-WebSocket-mainly carries
Some websocket parameters are returned by the same server.
Obviously, websocket can communicate with each other in the 101 status of the http connection.
2. Compile and test the jmeter script
1. Download The websocket dependent jar and put it in the/apache-jmeter-3.2/lib/ext directory.
2. Open WebSocket Sampler
2. write scripts
Ip: Test server Domain Name
Streaming Connection: whether to keep the Connection after the request. If this option is selected, continue the session in the same http
Protocol: ws/wss, wss encrypted transmission after websocket connection, according to the actual write
Port Number: ws80, wss443, same as http and https
Path: Write the specific request url
Request data: the content of each client request can be seen through charles packet capture.
By using the loop controller, you will find that you only need to establish a link and the subsequent request content will continue in this connection.
Iii. Comparison of ws/wss protocol and wireshark packet capture Analysis
When websocket is ws protocol, execute the interface to capture packets as follows to start http three-way handshake, and then request http
Request, websocket can be seen to be transmitted in plaintext
When websocket is a wss protocol, run the following interface to capture packets:
Start http three-way handshake and then connect to https. We can see that TLS v1.2 has been used for encrypted transmission.