NextJS 13 14, Store server state globally

21 views Asked by At

I am looking for a way in NextJS 13/14 to store global state on the server-side. Here is my use-case:

I have a LogReader that must access server-side logfiles and tails them live. It then receives updates and stores them in a global variable. Any and all connected clients should have access to this data.

I cannot store the data in a db, it has to live in memory and somehow be passed to clients. I've tried a websocket server, but every file on the server-side gets run once per client, rather than globally.

Anyone have any ideas?

0

There are 0 answers