title: Sending object from Node.js server to JS client
body: <p>My Node.js bot has a main file called "server.js" which receives messages from Discord.</p>
  
  <p>When it receives a message, I want it to send an object (that I will create) to the client.js file, which just controls the HTML page, so that I could display the message.</p>
  
  <p>How can I do that?</p>
  
  <p>P.S.: I'm very new to this, so I would appreciate if you could show an example of the implementation of what you suggest. Thanks!</p>
  
  <p><strong>What I have tried:</strong></p>
  
  <p>Currently I'm saving the message in a JSON file and reading it in the client JS file every second. It works, but I want a way to directly send the data as soon as a message is received.</p>