Discussion forum for David Beazley

Need suggestions about curio related things


Hello, i’m still learning to grasp how curio working under the hood.
I’m trying to builds something similar to daphne interfaces server, at http://github.com/django/daphne,
but i’m need some suggestions how i design and build the basic things.

I’m planning this need aware of sans io implementation, http://sans-io.readthedocs.io, so, i’m thinking of
using h11 https://github.com/njsmith/h11 for http 1.0/1.1 related and wsproto https://github.com/jeamland/wsproto for handling websocket related.
and for the basic, i want to use curio to back up the real implementation …

How your suggestion about this ?
Thanks for help


The honest answer—I don’t know the best way to structure this code. My guess is that if you’re aiming for the Sans I/O approach, you’ll want to follow the general style of what’s happening in h11 and the hyper-h2 libraries. The approach I’ve taken so far on things is to have objects that accept a feed of data, but which raise exceptions or signal some kind of error when more data is needed. Much of the code ends up being kind of similar to non-blocking I/O itself.

There also might be some interesting ways to use Curio queues as a communication mechanism (i.e., have all of the I/O bits handled by Curio, but hand data off to other code via some kind of queuing API).