python-websockets / websockets

Library for building WebSocket servers and clients in Python
https://websockets.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
5.23k stars 519 forks source link

To avoid double work please add byte as posible consumer for connection.respond() #1519

Closed stalkerg closed 4 weeks ago

stalkerg commented 1 month ago

Seems like new asyncio server process_request can't consume bytes, it's produce extra work.

aaugustin commented 4 weeks ago

You don't have to use the connection.respond() helper if you don't like it. You can build a Response object and return it.

aaugustin commented 4 weeks ago

The documentation of Connection.respond says "may call" — which implies that you don't have to.