SUBSCRIBE shouldn't have a payload from JMeter STOMP WebSocket testing

Issue #238 invalid
Zhang Zhao created an issue

I was trying to test some STOMP frames on top of WebSocket using JMeter 5.4.3, STOMP 1.2 and WebSocket Samplers 1.2.8. The STOMP client initiated the stream/TCP connection to the server successfully. I did receive the confirmation from the WebSocket Read Sampler as below:

CONNECTED
version:1.2
heart-beat:10000,10000
user-name:admin@xxx.xxx.xxx

Next step I was testing a SUBSCRIBE frame, below is an example of request body:

Connect URL:
wss://xxx.xxx.com:443/api/v1/xxx/xxx/participant
(using existing connection)

Request data:
SUBSCRIBE
id:0
destination:/v1/create/session
content-type:application/json

I constructed the request data using a BeanShell PreProcessor like below: I tried different string patterns based on STOMP v1.2 protocol spec.. However I received an error response from read sampler. Below was a pattern that I received an error msg. Is it sth. with the format of the frame?

String s = "SUBSCRIBE\n" +       
               "id:0\n" +
               "destination:/v1/create/session\n" +
               "content-type:application/json\n" +
               "\n" + 
               "^@\n" +
               '\0'  // note: NULL char at end
               ;
vars.put("wsStompSubscribeData", s);

Below is the error msg from the read sampler while I was expecting to receive a json response with STATUS as SUCCESS.

ERROR
message:SUBSCRIBE shouldn't have a payload\c length=3, headers={}
content-length:0

Comments (4)

  1. Zhang Zhao reporter

    Note:

    Had to remove “^@\n” out of the string in BeanShell PreProcessor as '\0' represents it.

  2. Log in to comment