[Twisted-Python] ws(s):// urls and host/port duplication in twisted/autobahn code

meejah meejah at meejah.ca
Wed Apr 10 11:46:47 MDT 2019


Chris Withers <chris at withers.org> writes:

> Not sure I follow, I specify ws:// and things work. What am I missing?
> (I know the initial protocol is http and that's "upgraded" into
> websocket, but the url is still ws:// or wss://, right?)

What Tobias is getting at, I think, is that your URL could be
wss://example.com/ws but the endpoint could be a unix-socket at
/var/run/foo

Now, that said, some of the APIs do allow you to shortcut this in the
case when your endpoint will be the same as the host in the URI. Compare
these two "Component" examples; the first uses the "long form" way to
specify the URL + transport and the second is just a string:

https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/wamp/component/backend.py#L34
https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/wamp/component/frontend.py#L42

>> fwiw, WAMP is a protocol with a clear-cut, rigorous and decoupled
>> layering:

> Do browsers speak WAMP?

Yes. See Autobahn-JS

> Do firewalls get upset with it?

No.

WAMP connections are usually "outbound" style connections to the router,
so most firewall configurations will be fine with this.

-- 
meejah




More information about the Twisted-Python mailing list