Closed NumesSanguis closed 6 years ago
With client_tx.py
it is also happening:
make start
docker run -v /*file_path*/app:/app -it --rm --link crossbar crossbario/autobahn-python
2018-02-01T17:58:17+0000 Scheduling retry 1 to connect <twisted.internet.endpoints.TCP4ClientEndpoint object at 0x7f5adbf06be0> in 1.58646347420017 seconds.
2018-02-01T17:58:19+0000 Scheduling retry 2 to connect <twisted.internet.endpoints.TCP4ClientEndpoint object at 0x7f5adbf06be0> in 3.118967674364628 seconds.
2018-02-01T17:58:22+0000 Scheduling retry 3 to connect <twisted.internet.endpoints.TCP4ClientEndpoint object at 0x7f5adbf06be0> in 3.9190793815686735 seconds.
2018-02-01T17:58:26+0000 Scheduling retry 4 to connect <twisted.internet.endpoints.TCP4ClientEndpoint object at 0x7f5adbf06be0> in 5.189386786132975 seconds.
2018-02-01T17:58:31+0000 Scheduling retry 5 to connect <twisted.internet.endpoints.TCP4ClientEndpoint object at 0x7f5adbf06be0> in 8.103285030929317 seconds.
2018-02-01T17:58:39+0000 Scheduling retry 6 to connect <twisted.internet.endpoints.TCP4ClientEndpoint object at 0x7f5adbf06be0> in 12.135480982977455 seconds.
2018-02-01T17:58:51+0000 Scheduling retry 7 to connect <twisted.internet.endpoints.TCP4ClientEndpoint object at 0x7f5adbf06be0> in 17.589164802301156 seconds.
2018-02-01T17:59:09+0000 Scheduling retry 8 to connect <twisted.internet.endpoints.TCP4ClientEndpoint object at 0x7f5adbf06be0> in 26.353133456840247 seconds.
When running everything normal (including message broker on 8080), except for changing in these 2 lines 8080
to 9090
in client_aio.py
:
url = os.environ.get('CBURL', u'ws://localhost:9090/ws')
parser.add_argument('--url', dest='url', type=six.text_type, default=url, help='The router URL (default: "ws://localhost:9090/ws").')
Everything still works. This means that these values are ignored and a hard coded port is used.
When running everything normal (including message broker on 8080), except for changing in these 2 lines 8080 to 9090 in client_aio.py:
url = os.environ.get('CBURL', u'ws://localhost:9090/ws') parser.add_argument('--url', dest='url', type=six.text_type, default=url, help='The router URL (default: "ws://localhost:9090/ws").')
Everything still works. This means that these values are ignored and a hard coded port is used.
I just tried and everything is working fine for me.
The first line reads the websocket url from environment variable CBURL
and fallbacks to ws://localhost:9090/ws
. So you probably have CBURL
in the environment.
Just replace
url = os.environ.get('CBURL', u'ws://localhost:9090/ws')
with
url = u'ws://localhost:9090/ws'
and you should have no issue.
You can ignore the port number in second line, that's just a help comment and does not affect functionality.
I changed the url as you suggested url = u'ws://localhost:9090/ws'
, and indeed it tries to connect over port 9090, but it still can't connect. I tried again with a fresh download and the steps I described in the first post.
crossbar.io output
make start
docker run --user 1000 -v /*file_path*/crossbar:/node -p 9090:9090 --name crossbar --rm -it crossbario/crossbar
2018-02-02T11:09:54+0000 [Controller 1] __ __ __ __ __ __ __ __
2018-02-02T11:09:54+0000 [Controller 1] / `|__)/ \/__`/__`|__) /\ |__) |/ \
2018-02-02T11:09:54+0000 [Controller 1] \__,| \\__/.__/.__/|__)/~~\| \. |\__/
2018-02-02T11:09:54+0000 [Controller 1]
2018-02-02T11:09:54+0000 [Controller 1] Version: Crossbar.io COMMUNITY 17.12.1
2018-02-02T11:09:54+0000 [Controller 1] Public Key: a1a1e70ebf2eea4ab01cb2a921f0480c2d2c3ab237b9202d8c602c16ad58208b
2018-02-02T11:09:54+0000 [Controller 1]
2018-02-02T11:09:54+0000 [Controller 1] Node starting with personality "community" [crossbar.controller.node.Node]
2018-02-02T11:09:54+0000 [Controller 1] Running from node directory "/node/.crossbar"
2018-02-02T11:09:54+0000 [Controller 1] Node configuration loaded from "/node/.crossbar/config.json"
2018-02-02T11:09:54+0000 [Controller 1] Controller process starting [CPython-EPollReactor] ..
2018-02-02T11:09:54+0000 [Controller 1] No extra node router roles
2018-02-02T11:09:54+0000 [Controller 1] RouterServiceSession ready [no on_ready configured]
2018-02-02T11:09:54+0000 [Controller 1] Registered 20 procedures
2018-02-02T11:09:54+0000 [Controller 1] Using default node shutdown triggers ['shutdown_on_worker_exit']
2018-02-02T11:09:54+0000 [Controller 1] Configuring node from local configuration ...
2018-02-02T11:09:54+0000 [Controller 1] Starting 1 workers ...
2018-02-02T11:09:54+0000 [Controller 1] Router worker "worker-001" starting ..
2018-02-02T11:09:54+0000 [Router 16] Started Router worker "worker-001" on node "None" [crossbar.worker.router.RouterWorkerSession / CPython-EPollReactor]
2018-02-02T11:09:54+0000 [Router 16] Router worker "worker-001" session 2023671309079076 initializing ..
2018-02-02T11:09:54+0000 [Router 16] Registered 39 procedures
2018-02-02T11:09:54+0000 [Router 16] Router worker "worker-001" session ready
2018-02-02T11:09:54+0000 [Controller 1] Router worker "worker-001" process 16 started
2018-02-02T11:09:54+0000 [Router 16] RouterServiceSession ready [configured on_ready fired]
2018-02-02T11:09:54+0000 [Router 16] Realm 'realm1' started
2018-02-02T11:09:54+0000 [Controller 1] Router "worker-001": realm 'realm-001' (named 'realm1') started
2018-02-02T11:09:54+0000 [Router 16] role role-001 on realm realm-001 started
2018-02-02T11:09:54+0000 [Controller 1] Router "worker-001": role 'role-001' (named 'anonymous') started on realm 'realm-001'
2018-02-02T11:09:54+0000 [Router 16] UniSocketServerFactory starting on 9090
2018-02-02T11:09:54+0000 [Controller 1] Router "worker-001": transport 'transport-001' started
2018-02-02T11:09:54+0000 [Controller 1] Local node configuration applied successfully!
client_aio.py
make start
docker run -v /*file_path*/autobahn-python/app:/app -it --rm --link crossbar crossbario/autobahn-python
Traceback (most recent call last):
File "client_aio.py", line 130, in <module>
runner.run(ClientSession)
File "/usr/local/lib/python3.6/site-packages/autobahn/asyncio/wamp.py", line 259, in run
(transport, protocol) = loop.run_until_complete(coro)
File "/usr/local/lib/python3.6/asyncio/base_events.py", line 467, in run_until_complete
return future.result()
File "/usr/local/lib/python3.6/asyncio/base_events.py", line 786, in create_connection
', '.join(str(exc) for exc in exceptions)))
OSError: Multiple exceptions: [Errno 111] Connect call failed ('127.0.0.1', 9090), [Errno 99] Address not available
Makefile:4: recipe for target 'start' failed
make: *** [start] Error 1
While the javascript works fine on port 9090.
I want to run my Python client/publisher on port 9090 (or any other port), because some other program is running on 8080.
My project is setup as followed using Docker (following https://crossbar.io/docs/Getting-Started/):
Message broker on port 9090:
git clone https://github.com/crossbario/crossbar-starter.git
cd crossbar-starter/crossbar
8080
to9090
in.crossbar/config.json
andMakefile
http://localhost:9090/
Python pub/sub on port 9090:
cd ../autobahn-python
app/run
commentpython -u client_tx.py
and uncommentpython -u client_aio.py
app/client_aio.py
and change 28080
to9090
.make start
and get the following error:Problem Seems like port 8080 is hardcoded somewhere when using
asyncio
version of client.