Closed juanyacovino77 closed 1 year ago
I think @adospace anticipated this question :)
https://github.com/adospace/mauireactor-samples/tree/main/ChateoApp https://github.com/adospace/mauireactor-samples/blob/main/ChateoApp/Chateo/Pages/ChatsPage.cs
That is awesome!!!!!
I would just like to ask about why he subscribes to the callbacks and gets the service every time OnMountedOrPropsChanged() its call instead of subscribing once at the OnMounted() method? What happens there? Something else,, would be nice too to unsubscribes from the callbacks at the WillUnmount() event?
Anyways that samples helps a lot!
Thanks!!!
yes, you can also subscribe in the UnMounted() and unsubscribe in the OnWillUnmount(): probably it's just a matter of personal choice and how the service is implemented. In the coming weeks, as I've time I will experiment with other solutions like having a service that maintains all the messages received by the server so as to avoid getting them every time from the server. Also, it would be interesting to integrate a global state manager like https://github.com/mrpmorris/Fluxor.
I encourage you to experiment with various solutions that best fit your requirements, but in general, in MauiReactor the solution is subscribing to events during the component lifetime and updating the component state accordingly.
I could even say that the MVU approach really gives the best in this kind of application.
I'll be happy to help in case you need it.
Ado you are really kind man,
for me it is okay to subscribing to event during the component lifetime.
Really grateful
Hi, I am betting on Maui Reactor to build a chat-based app with SignalR. I wonder on best way of implementing signalR client with MVU components.
One way is to implement signalR client logic inside components, but..
Is it possible to change a component state or to programmatically invoke a component method from outside a component? from a Services.cs class for example?
Let say my server push me updates through SignalR, websockets, o server-sent events , how can I call a component from elsewhere in the maui reactor app where there is the signalR endpoint implementaion?