Managing Scoped Resources with Conditional Service Initialization

normally i'd scope resources to an Effect.Service, like a Socket server / connection and handle events w/ .forkScoped

in this case i have a manager service that then decides whether to be a 'socket client' or 'socket server' and should delegate the handling of that to a specified service

but in the service i have to yield* the dependencies at the top, which would also start the connection/server automatically with the scope of the manager

what would be an appropriate pattern for this?
Was this page helpful?