Swift NIO closes WebSocket channel on Client

I have an issue where my Websocket Channel is closing. To begin let me discuss the basic setup.

My Project has a NIO Client Websocket Library. One part of the application spools up the websocket and is under constant use. Another part of the application also needs it's own Socket. So it spins up another instance for itsself. These 2 instances never cross each others paths.

When I start the app Socket 1 spins up communicates with a server and sends me back information needed by the app. When that information is received we spin up our second socket and start communicating with another server. Everything seems to communicated properly, until the application receives information at a certain period of time. Then the WS Channel is removed.

The Basic flow is as follows -


@globalActor MyGlobalActor {
static let shared = MyGlobalActor()
}

@MyGlobalActor
class WSHelper {
 var receivedBinary: Data? {
        didSet {
          try delegate?.webSocket(receivedBinary)
         }
    }
}

@MyGlobalActor
class MyClass {

func webSocket(_ binary: Data) {
       consumer.feedConsumer(data)
}

// Fired from a notification when the consumer has enqueued data
// Whether I feed the data directly off the socket or enqueue it doesn't seem to matter, The channel still becomes inactive.
// In this example I enqueue data into an AsyncSequence in order to try to avoid Threading issues between NIO and Swift Concurrency.
// processsData() is fired multiple times. On what seems to be the second time handlerRemoved is fired in the WS. However subsequent calls to the socket say that on channelRead the Socket is active.
    @objc func processData() {
        Task {
            for try await data in MySequence(consumer: consumer) {
                if data == someData {
                    await methodOne(data)
                }
                
                if data == anotherData {
                    await methodTwo(data)
                }
            }
        }
    }


func methodOne(_ data: Data) async {
     await sendDataToServerAndGetNewResponse()
}

func methodTwo(_ data: Data) async {
     await sendDataToServerAndGetNewResponse()
}

For what reasons will handlerRemoved be called? I have scratching my head on this for awhile now.

Any help is appreciated,

Thanks in advance