Creating simple chat-functionality?

Hi. I have zero skills what so ever with javascript, I can read and sort of get the main concepts of it, but that is kinda it. So I´ve asked chatgpt for help. But of course it doesn't work. I've tried a whole bunch of times and taking it step by step, and changin things here and there, but I just can't get it to work.

I´ve created two textarea-widgets.
The one with the id messageInput has this code in onValue:

this.on("keydown", function(event) {
if (event.key === "Enter" && !event.shiftKey) {
event.preventDefault(); // Prevents adding a new line on Enter
sendMessage();
}
});

function sendMessage() {
const newMessage = this.value.trim();
if (newMessage !== "") {
// Send the message by appending it to the chat history
let currentHistory = get("/chatHistory") || ""; // Get existing history or empty string
set("/chatHistory", currentHistory + newMessage + "\n"); // Append new message
this.value = ""; // Clear the input field
}
}

The textarea-widget named chatHistory has this code in the onValue:

this.on("value", function() {
// Scroll to the bottom whenever new text is added
this.scrollTop = this.scrollHeight;
});

This is what chatgpt suggested, its just copy paste the code from chatgpt, and I'm not shocked at all it doesn't work. Nothing actually happens, the text I input into the messageInput widget just stays there, pressing enter even doesn't work.

target is "all" for both inputs. and chatHistory is listening to /chatHistory

I'm looking for some simple functionality where a few different clients can text with each other and everyone can see what has been said. Even nicer functionality would be if the different clients would get different names, or colors, or whatever so one can distinguish who wrote that, but that was planned to try to figure out of after just getting the basic funtionality to work.

Honestly this feels very much out of the app's scope. If I needed a chat app in a control surface I'd host the chat with a dedicated software and display it in open stage control with a frame widget.

Gotcha. Seems reasonable. Thanks!

Just my personal opinion, but I'd use my phone for this, which is why I never use my phone as a control surface to run a show other than in an extreme emergency. I keep my phone for comms and use tablets as control surfaces.

Yeah. Been using phone, but wanted to upgrade that whole thing. Was curious if there was some app of some kind where I could make a phone or Ipad on stage like alarm-flash, with a message, using OSC, and came over open stage control a bit on the side. I got curious (about the show control capabilities) but then I noticed one could indeed send text, and make things flash, so I was curious if it would work.

You can certainly send a text string in an OSC message and have the label flash or change color when a new message arrives. Text area seems like the widget to look at.

Yes, I was able to do that. But I wanted the chat-functionality on the same place too. If bi-directional texting is not available the same place the visual alert goes off, there's no point.