Frequently asked questions¶
Many questions asked in websockets’ issue tracker are really
about asyncio
.
If you’re new to asyncio
, you will certainly encounter issues that are
related to asynchronous programming in general rather than to websockets in
particular.
Fortunately, Python’s official documentation provides advice to develop with asyncio. Check it out: it’s invaluable!
- Server
- Why does the server close the connection prematurely?
- Why does the server close the connection after one message?
- Why can only one client connect at a time?
- How do I send a message to all users?
- How do I send a message to a single user?
- How do I send a message to a channel, a topic, or some users?
- How do I pass arguments to the connection handler?
- How do I access the request path?
- How do I access HTTP headers?
- How do I set HTTP headers?
- How do I get the IP address of the client?
- How do I set the IP addresses that my server listens on?
- What does
OSError: [Errno 99] error while attempting to bind on address ('::1', 80, 0, 0): address not available
mean? - How do I close a connection?
- How do I stop a server?
- How do I stop a server while keeping existing connections open?
- How do I implement a health check?
- How do I run HTTP and WebSocket servers on the same port?
- Client
- Why does the client close the connection prematurely?
- How do I access HTTP headers?
- How do I set HTTP headers?
- How do I force the IP address that the client connects to?
- How do I close a connection?
- How do I reconnect when the connection drops?
- How do I stop a client that is processing messages in a loop?
- How do I disable TLS/SSL certificate verification?
- Both sides
- What does
ConnectionClosedError: no close frame received or sent
mean? - What does
ConnectionClosedError: sent 1011 (internal error) keepalive ping timeout; no close frame received
mean? - How do I set a timeout on
recv()
? - How can I pass arguments to a custom connection subclass?
- How do I keep idle connections open?
- How do I respond to pings?
- What does
- Using asyncio
- Miscellaneous