Getting live updates in server component
Answered
Savannah posted this in #help-forum
SavannahOP
Hey all, I'm trying to create a component that receives some updates from a web socket, and I want it to re-render the page.
Could not find a way to do so in a server component.
On client component that's fairly simple.
What would be the correct way to show for example live stock prices?
Could not find a way to do so in a server component.
On client component that's fairly simple.
What would be the correct way to show for example live stock prices?
Answered by Netherland Dwarf
You just should stick to client component in your case : server components are pre-rendered on the server before beeing sent to the client => there's no way you can establish a connection to your socket inside SC
3 Replies
Netherland Dwarf
You just should stick to client component in your case : server components are pre-rendered on the server before beeing sent to the client => there's no way you can establish a connection to your socket inside SC
Answer
Netherland Dwarf
As you need the client's browser to make the request
SavannahOP
Hmm, thats a good point, thanks