Websocket DAT info parsing

Hello,

I am trying to get websockets to work. I have managed to open up 2 websocket connections on the same computer. One is from the console and the other is in TD. I also have an HTML page, which is used to send data to Touchdesigner. This data is encoded with JSON.

var data = {'action':'start'}; websocket.send(JSON.stringify(data));

This data reaches the Touchdesginer’s Websocket Dat panel easily.
The “websocket1” panel itself displays this information (using standard empty functions):
{“action”:“start”}

This means the string correctly reaches the panel.
However, I would like to use this data. I would like to know that the key “action” exists and that it has the value “start”. How do I detect this info? I’ve tried sending this to the Convert Dat panel and from there to Text Dat. Information seems to be moving nicely between the panels.
Also, when I modify the Websocket Dat script’s function onReceiveText and add a print(“Test”) statement between the return call, the text does not get printed into the Websocket Dat panel. Is it printed somewhere else?

Thank you,
Jens

To be more precise, I need to send this information to an if statement somehow.
So if ‘action’ is ‘start’, do one thing. If ‘action’ is stop, do another thing, and so on.

I found the answer. I simply had to add the DAT Execute operator to the output of the websocket callback operator. This allowed me to execute the functions and create my “if” statements using python.