Summary
WebChannel accepts an optional injected httpx.AsyncClient, but close() always calls self._client.aclose().
Why this is a problem
If an application shares one httpx.AsyncClient across multiple transports or uses it elsewhere, closing a single WebChannel instance unexpectedly shuts down the shared client and breaks unrelated requests.
Where
src/python_webchannel/channel.py
Expected behavior
The channel should only close an internally-created client. If the client was injected by the caller, ownership should remain with the caller.
Suggested fix
Track client ownership in __init__ (for example, self._owns_client = http_client is None) and only call aclose() from close() when the client was created internally.
Impact
This can cause hard-to-debug connection errors in apps that correctly reuse httpx.AsyncClient instances.
Summary
WebChannelaccepts an optional injectedhttpx.AsyncClient, butclose()always callsself._client.aclose().Why this is a problem
If an application shares one
httpx.AsyncClientacross multiple transports or uses it elsewhere, closing a singleWebChannelinstance unexpectedly shuts down the shared client and breaks unrelated requests.Where
src/python_webchannel/channel.pyExpected behavior
The channel should only close an internally-created client. If the client was injected by the caller, ownership should remain with the caller.
Suggested fix
Track client ownership in
__init__(for example,self._owns_client = http_client is None) and only callaclose()fromclose()when the client was created internally.Impact
This can cause hard-to-debug connection errors in apps that correctly reuse
httpx.AsyncClientinstances.