I have created a react app which listens to a stream in real time. Whenever a new stream object comes in, I fetch it and append it to my state. So a user will see all of the stream data since that user started streaming.
Now the problem is, if a second user starts streaming at some later time, he won't see any of the data which the first user has received.
I want to make one state common for all users. So that when they plug into my stream they see the same state.
How can i do that? I am using flask API which is providing me with the stream.
CodePudding user response:
If you want to show the same stream for all users/browsers you cannot do it using the frontend only, because you don't have this information. You should look into the backend side to return the same data from your API.
That's why state management frontend libraries and other frontend tools will not help you, because it works only for this particular user.
CodePudding user response:
Quoting from redux.org
Centralizing your application's state and logic enables powerful capabilities like undo/redo, state persistence, and much more.
I think this is what you are looking for creating a centralized state for your users :)
