websockets library compatibility¶
picows.websockets reimplements the common websockets.asyncio interface on
top of the picows core API. It is intended to make migration from websockets
straightforward for typical client and server applications, but it doesn’t
implement every extension point exposed by the original websockets package.
If you need a specific feature of the original websockets library, do not hesitate to create a feature request.
The following features from websockets aren’t currently supported:
Custom WebSocket extensions passed with the
extensionsargument toconnect()orserve().permessage-deflateis supported through the standardcompression="deflate"setting, andcompression=Nonedisables it. Other extension factories aren’t accepted.Asynchronous
process_requestandprocess_responseserver hooks. Synchronous hooks are supported.Asynchronous
basic_auth(check_credentials=...)callbacks. Static credentials and synchronous credential checks are supported.Custom connection classes through
create_connectiononconnect()orserve().Unix socket helpers such as
unix_connect(),unix_serve(), andunix_route().websockets.asyncio.router.route()and the router classes. You can route at the application level fromwebsocket.request.pathinstead.ServerConnection.respond()for building plain-text HTTP responses in handshake hooks. Construct and return apicows.websockets.Responsedirectly from synchronousprocess_request/process_responsehooks.The full upstream distribution surface, including the threading, Sans-I/O, and legacy APIs.
picows.websocketsfocuses on the asyncio API.Proxy support covers the common
proxy=True,proxy=None, and explicit proxy URL cases. Advanced upstream proxy TLS keyword handling, such asproxy_ssland relatedproxy_*options for HTTPS proxies, isn’t mirrored. The picows core currently supports HTTP, SOCKS4, and SOCKS5 proxies, not HTTPS proxy URLs.sslmay be omitted, set toTrue/None, or set to anssl.SSLContext. Passingssl=Falseforwss://URIs isn’t supported.