-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use twisted endpoint description strings to bind to ports and sockets #37
Conversation
We're actually looking at rewriting Daphne itself to use more of the Twisted stuff natively that comes around this, so I'm going to leave this for now until we have that done, as it may clash with what's coming there (it's mostly around the pluggable TLS/Lets Encrypt stuff, and HTTP2 support) |
@andrewgodwin In fact, pluggable LE and HTTP/2 would benefit from having this merged first. Pluggable LE is managed by Twisted endpoints (which this PR enables), and HTTP/2 requires TLS support (which is also enabled by this PR). So my recommendation is that we hammer this into shape for merging and then I'll look at what code changes are required to get HTTP/2 support for Daphne. LE support should drop out in the form of txacme. |
Alright, good to know - I'll see if I can find some time to merge it in once the checks pass. |
The builds are now passing. And then pass the endpoints to the servers init method. That would probably make for a cleaner interface. Is the Server class meant to be public, or would it be ok to change it so that it can only handle endpoint descriptions as opposed to host/port/unix sockets? |
The Server class is kind of public - it's used directly by the |
Ok. I'll work on that during the DUTH sprints. |
@andrewgodwin: did you mean that the channels runserver command should be able to accept twisted endpoint description strings? Any ideas/comments? Otherwise I guess this could be merged. |
I meant that I'd like to see the Server class accept endpoint strings only and remove the host/port/unix socket arguments. I'd still want the |
I actually meant this comment:
Anyway, the latest commits deprecate the use of host/port/socket names/file_descriptor on the Server class and move the building of endpoint description strings to a separate function. |
Lovely - thanks for your work on this! |
Hi, I tried following call of daphne
Does it mean, that is should connect to <my_ip> with WSS protocol on 8443 port? |
You can simply remove the -b option from your command. |
@mcallistersean thank you. The log I provided is created by daphne call without -p argument. Anyway, does my log mean that daphne listens to both 8443 and 8000 port? |
-p was just another example of a command line flag that overrides the defaults. Actually daphne just uses -b and -p options (with fallback defaults) to construct the endpoint string you are seeing above. The -e string is interpreted directly by twisted, so it does what twisted does by default (all interfaces). If you want to be on the safe side just add
Yes, but the server listening on port 8000 is not secure |
This implements the usage of twisted server endpoint description strings to connect to ports, sockets and such as discussed in #10
This allows daphne to support cases such as #17 and #36 without needing any extra code.
E.g.
starts up a SSL enabled server on port 8443