You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have made my own custom http client that is used to encrypt and sign all requests it is sending and verify/decrypt all requests it is receiving.
I the client is instantiated in the beginning of the application and needs to be used on multiple different screens. I want to avoid prop drilling the client down through the whole application, so I am considering using Context, however the client does not implement Clone, PartialEq at the moment and I am not sure how easy it would be to make it implement those.
I saw a tutorial where a guy was using Agents to have a websocket client so I am considering doing that instead - but I am not really sure if this is the best way. And I cannot find any other examples of using agent that are related to my problem.
To summarize:
I think there a 3 possible solutions:
Make myClient implement Clone and PartialEq and use it in a context
Store myClient in an agent and communicate with the agent from the application
Managing everything in my mainScreen and passing callbacks down to different components who need to do something with client.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have made my own custom http client that is used to encrypt and sign all requests it is sending and verify/decrypt all requests it is receiving.
I the client is instantiated in the beginning of the application and needs to be used on multiple different screens. I want to avoid prop drilling the client down through the whole application, so I am considering using Context, however the client does not implement Clone, PartialEq at the moment and I am not sure how easy it would be to make it implement those.
I saw a tutorial where a guy was using Agents to have a websocket client so I am considering doing that instead - but I am not really sure if this is the best way. And I cannot find any other examples of using agent that are related to my problem.
To summarize:
I think there a 3 possible solutions:
Beta Was this translation helpful? Give feedback.
All reactions