Question · Vibe coding with Claude Code course · Module 7: LinkedIn clone

Quiz: Receiving an event (onmessage)

What does the tab do in source.onmessage when an event arrives from the stream?

Answer options

  • It sends event.data back to the server
  • It runs JSON.parse(event.data) and appends the message to state through setMessages
  • It refreshes the whole page to fetch the conversation history
  • It saves event.data to data/messages.json

You can check the correct answer by solving this task in the CodeWorlds game.