const webSocket = WEB_SOCKET() //grab a reference to the global WebSocket object mentioned earlier //This allows us to run a function every time the WebSocket receives a message. //In this example, this happens any time we send a message because the echo WebSocket sends our message back to us. webSocket.addEventListener('message', function(event) { //This gets a reference to the global response messages list (array) and appends the response that comes back from the echo WebSocket MESSAGES().push(event.data) //This is a retool hacky thing to ensure the text actually visually updates its contents. text1.setValue(MESSAGES().join('\n')) });