Am 02.04.19 um 09:50 schrieb Chris Withers:
On 02/04/2019 08:25, Tobias Oberstein wrote:
https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/wamp/basic/client_using_clientservice.py
Any way to get rid of the ugly duplication between the url in line 69
and the endpoint on line 72?
I seem to remember that ends up happening with or without ClientService.
I am aware, but no, it's designed like this, because WebSocket
requires a HTTP URL (with potentially path components, query
parameters etc) in the opening handshake while the _transport_ does
not necessarily have that.
Autobahn allows you to run WebSocket over basically everything that is
a bidirectional byte pipe: TCP of course, but also Unix domain socket,
pipes, Tor onion services (via https://github.com/meejah/txtorcon) and
even serial ports!
Right, but correct me if I'm wrong, my understanding is that URL stands
for Univeral Resource Locator and URLs can encode all of the things you
WebSocket needs a _HTTP_ URL
an URL from the HTTP scheme cannot encode eg a Unix domain socket path
or a serial port
one could certainly come with with other/different non-HTTP URL schemes
.. and in some way, Autobahn WAMP machinery has sth in that direction:
eg WAMP can be run not only over WebSocket, but also RawSocket, which is
a WAMP-specific transport (above byte-level, at the framing level), that
is simpler than WebSocket, and for that we using (non-standard) URLs like
rs://<host:port>
rss://<host:port>
fwiw, WAMP is a protocol with a clear-cut, rigorous and decoupled layering:
- bidirectional reliable byte level transport (tcp, uds, pipes, ..)
- message framing (websocket, rawsocket, ..)
- serialization (json, cbor, flatbuffers, ..)
and Autobahn and Crossbar.io support _every_ combination of those layers
(dozens) to run WAMP
describe. They certainly contain the host and port, so shouldn't there
be a graceful way to specify a URL once and have everything that needs
that info or a subset of it get it from there?
a (fully qualified) HTTP URL of course encodes a host and port, but that
only covers transports that have those notions
(This isn't necessarily aimed at AutoBahn, seems to be something common
in Twisted...)
things look only "simple" when leaving out details;)
anyways: this is now OT to the original issue I would think ..
Chris
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python