Hello,

On dv., maig 24 2019, Jayanth Acharya wrote:

Thanks Meejah. Appreciate your clearing up that Flask is not based on
twisted, not sure I got that impression earlier.
Checked Klein, and it seems quite promising (and seem quite similar to Flask, from developer standpoint). From the documentation it was not quite
evident to me, as to how to use HTTP2 under Klein.
I did find a reference to HTTP2 in this pull-request, but again not clear
to me: https://github.com/twisted/klein/pull/113

Checked treq, but is it really advantageous over request ? Also found no
reference to HTTP2 in treq documents.

Alao thanks for the references to Crossbar.io and Autobahn. Will check them
out shortly.


Just let me add something that may have been "obvious to everyone" on that PR and not to you at that point, but it will be "obvious" to you after the next 5-20 minutes:

Notice how that PR introduces the "endpoints" concept, that is a *very* useful concept in Twisted, which basically allows you to add support for pretty much any transport without any effort.

So, if you want to run an HTTP2 server, you need two things:

1. Read this bit of the klein and twisted documentation:
  
https://klein.readthedocs.io/en/latest/examples/alternativerunning.html#example-ipv6-tls-unix-sockets-endpoints
  https://twistedmatrix.com/documents/current/core/howto/endpoints.html
2. Then you have to install the optional twisted[http2] dependency *and* because HTTP2 requires TLS, you have to enable that by using the endpoints API (e.g. in klein).

That's it for the server.

Twisted's documentation *could* be a bit better on this, if you want to take a go at it, I'm reasonably sure everyone would be happy.

The only mention I found for http2 on twisted docs is:
https://twistedmatrix.com/documents/current/installation/howto/optional.html?highlight=http2
There is also this article which AFAIK still applies, except the optional dependency is twisted[http2] instead of twisted[h2]:
https://pawelmhm.github.io/python/twisted/http2/python3/2016/07/30/twisted-http2.html

Notice that an easy one would be to edit the documentation I linked to before, and add an example that runs an HTTP2 server, future people like you will be able to find a small example with the search bar :-).
--
Evilham

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to