Closed geomen888 closed 3 years ago
there is no relation between websocket and ssr。you can write websocket like traditional spa+nodejs program。i will provide an example at a later time
In addition, websocket like traditional manner I think that primitive. The logic that already realized provides in brief: if trigger something at client It requests server-side, than some data fetched throw api and it re-renders client-side UI. My expectations that U provide some example where server-side (nest-js) listen some ws events, when it updates by data messaging, then it will hydrate & re-render client-side UI. Or do the same by emit ws event action from client-side. Besides implementation ws at server-side is more advanced in authentication (headers, protocols, tokens)
I can't understand well about what's your mean, hydrate behavior has been only happened at the first render in client side. websocket should be established after hydrate for example in mounted/componentDidMount lifecycle. when client side receive server side message lead to rerender which behavior is the same as csr application.
you can use ssr-nest plugin, the scafold will be init a nest project, then you can add ws\socket.io, maybe it is better
Hi, what about websockets (ws\socket.io) support? As for server: nest-js it's socket implementation is oblivious. But If U put some example regarding client part it's will be great. Thank U