0

I'm a developer who just started NUXT3.

Is the following scenario possible using NUXT3 and related modules?

An integer variable exists on the server. The screen of the customer accessing the web page displays the current value of the variable. Each customer can increase the value of that variable by 1 through the button. At this point, the value should be automatically updated on the screen of all connected customers.

I know Vue.js and Websocket very well, so I've already implemented these programs using both.

But websocket is too cumbersome. All customers must be managed in a clientList array. Every time a variable changes, data must be sent to every time customers. If the customer's phone's network is unstable and the connection is disconnected for a while, they should also handle the error during that time.

But nuxt 3 is a server-side rendering platform! I feel like what I want is possible.

Or, even if it's not a web socket or socket.io, is there a good replacement for this real-time communication?

1 Answers1

1

Once you have your SPA hydrated, there is no way to re-render on the server without nuking all of it with a hard refresh. So yeah, websockets are probably the best way but others solutions exist too: https://stackoverflow.com/a/74405860/8816585

Those tools are meant for that and work well so use them.

kissu
  • 40,416
  • 14
  • 65
  • 133