I'm looking for some 'beyond basic' guidance on usage patterns for the StreamReader and StreamWriter classes in the Python asyncio package.
I am attempting to build a stateful server with a custom protocol using protobuf. Should I be sub-classing the StreamReader and StreamWriter to manage the serialization from protobuf bytes? I could then provide a read_message function on the reader. I know I can copy the code from streams.start_server providing my own StreamReader, but how do I set my StreamWriter?
Any pointers or examples gratefully received.
I suggest instead of deriving from StreamReader/StreamWriter invite your own class(es) with similar API. Say, I did it for
aiozmqlibrary: https://github.com/aio-libs/aiozmq/blob/master/aiozmq/stream.py