Websocket response parsing

I’m testing a chatting application on websocket with JSON message exchanges. The flow as follow:

  1. Open a websocket URL
  2. Server will send a list of JSON message (in order) in response

(i) Indicate the available presence status



(ii) Inbox messages to be acknowledge

“list”: [{“entityId”:379,“entityType”:“GROUP”,“createdDate”:“10-04-2016 03:21:030”,
{“entityId”:379,“entityType”:“GROUP”,“createdDate”:“10-04-2016 03:21:080”,


(iii) Friend list

{"id":622,"type":"PENDING_ENTITY_LIST", "payload":{...} }

(iv) Others Entities


  1. Acknowledge the 2.(ii) for all the chatMessageId (5342, 5343) by sending a JSON message back to the server
  1. Acknowledge the 2.(iv) based on the id (15441) by sending a JSON message back to the server

I’m stuck with the code as follow:


.exec(ws(“Connect WS”).open("/share/chat-service").pause(3)

.check(wsListen.within(30 seconds).until(4)

.foreach("${ackTypes}", “ackType”){
exec(ws(“Acknowledge pending message”)…


I have two questions here:

  1. the ackTypes seem to be null as the execution always come back with the error message "Condition evaluation crashed with message ‘No attribute named ‘ackTypes’ is defined’ "
  2. How to save the “chatMessageId” (5342, 5343) based on the type: “PENDING CHAT”, and the ID (15441) when type: “RECEIPT_LIST”, something like follow:

if type == "PENDING_CHAT" then foreach (mesgId in chatMessageId) { ack mesgId } else if type == "RECEIPT_LIST" then ack id end if

I’m currently using gatling v2.1.7 on a Mac OS 10.11.4. Your help will be greatly appreciated.