-
Notifications
You must be signed in to change notification settings - Fork 187
User manual
Similarly to the HTTP Sampler Server WebSocket connection needs a server address and a port number to initiate a connection. Firstly JMeter sends HTTP request to the server requesting connection upgrade to the WebSocket protocol. When the connection is successfully established server will send a confirmation message finishing the handshake. If for any reason the confirmation is not sent from the server within the connection timeout period the sampler will fail.
Due to the fact that current implementation is using Eclipse Jetty libraries for WebSocket connection is not possible to use web server via a proxy server.
Once the connection is established sampler will wait for a server message for the time defined in the response timeout. Since the server can send many responses to the client the usual request-response paradigm is broken. WebSocket sampler solves this problem by comparing each response against the “response pattern” and returns sampler response only when the response matches the pattern.
If no response is received within the time specified as a response timeout the sampler will return the last response (or responses).
Since the server can send a message to the client at any time it would be possible to receive a server response while no sampler is waiting for a message. In order to avoid those cases it is possible to specify message backlog which will keep the last N messages received by the WebSocket.
Depending on the tested application the test might need to simulate HTTP like request-response connection model or multiple clients maintaining a connection over the whole duration of a test. Both of those tests could be accomplished with the WebSocker sampler.
Streaming connection will remain open for as long as the test is running or until the one of the responses will match the “close connection pattern”. Even when the connection is closed it will be automatically reopened the next time it is required. Streaming connections could be shared between samplers within the same thread by using Connection Id. This feature allows for multiple WebSocket connections by a single JMeter thread.
WebSocket connections are not shared between JMeter threads and running a test with 100 concurrent users will open 100 WebSocket connections.