Unanswered question

Is there a way to send dynamic data in a websocket request?

I have an asynchronous WebSocket Request, with "Text Data" as the type, as I want to send JSON, e.g. {"Id":100,"Type":42,"Body":{}}. Can one of the JSON fields (e.g. "Id") have a dynamic value, for example take the value of a loop counter or of a variable I have set before?

Theodore T.
Theodore T.

Theodore T.

Level
0
22 / 100
points

Answers

Hi, Any part of the JSON can be parameterised, so id_1, id_2, etc is possible. The issue would be does your application accept these different names. Typically parameter names are fixed and values change

Theodore T.
Theodore T.

Theodore T.

Level
0
22 / 100
points

Hi, probably my question was not clear enough. "Id" is the name of the JSON field, 100 is the value of the JSON field. I want 100 to be taken from a variable. My websocket request is inside a loop, so I want to send something different each time the loop executes. So the data in the websocket request should be something like {"Id":${loop_counter},"Type":42,"Body":{}}. Is this possible?