Service tied to user sessions

In the browser, I have a service tied to user sessions, which is created on sign-in and destroyed on sign-out. There must be one and only one service per user session.

Currently I have a meta-service that holds a Ref<Option<service>> to manage the service lifecycle. The meta-service is part of a ManagedRuntime, allowing effects across the app to access the Ref.

Is there a better approach?
Was this page helpful?