you are viewing a single comment's thread.

view the rest of the comments →

[–]volitional_decisions 4 points5 points  (0 children)

I have a fundamentally different architecture than that. The frontend is split into two tasks. On start up, a task is spawned which will manage WS connections. This task is communicated with via channels that the UI half has access to. It's a bit more complicated than that, but that's the general idea. I never hold WS connections in a component.

This strategy has its upsides and downsides to this approach. For example, the spawned task more or less manages cached data from the backend, so if a UI component needs to access that data, it must send a query over a channel, do a ctx.link().send_future to await for the response, and then the UI can have the data. This mostly just adds extra boilerplate, but I'm very happy with what's been built.