what you're looking for is dynamic rendering, which is under server rendering strats if you're using solely nextjs.
Though a more full approach would be to leverage...
- server-side render initial message. where you fetch the latest message.
- then use websockets for real-time updates.
- maybe even utilize streaming for UI UX here as well
example