Autobahn with asyncio - unable to create connection for URL with paths

I am trying to connect to two WebSockets (WebSocket A with URI wss: //domainA.com and WebSocket B with URI wss: //domainB.com/path) using Autobahn running on asyncio as described in Autobahn docs .

I created a WebSocketClientProtocol file, for example:

from autobahn.asyncio.websocket import WebSocketClientProtocol

class ClientProtocol(WebSocketClientProtocol):
    def onConnect(self, response):
        print("Connected to Server: {}".format(response.peer))

      

and connecting to WebSocket using asyncio connection:

from autobahn.asyncio.websocket import WebSocketClientFactory
import asyncio

factory = WebSocketClientFactory()
factory.protocol = ClientProtocol

loop = asyncio.get_event_loop()

coro = loop.create_connection(factory, 'domainA.com', 80)

loop.run_until_complete(coro)
loop.run_forever()
loop.close()

      

I can connect to WebSocket A, but connecting to WebSocket B by replacing domainA.com

with domainB.com/path

results in an errorgaierror: [Errno 8] nodename nor servname provided, or not known.

I know WebSocket B is working, since I can connect to it using another library. Moreover, replacing domainB.com/path

only by domainB.com

, we obtainconnection was closed uncleanly (WebSocket connection upgrade failed (301 - MovedPermanently))

+3
python-3.x python-asyncio autobahn


source to share


No one has answered this question yet

Check out similar questions:

20
Python - Running Autobahn | Python asyncio websocket server in a separate subprocess or thread
4
Autobahn Asyncio ReconnectingClientFactory
3
How to connect to binance websocket service using autobahn with asyncio
2
asyncio: unable to create new event loop
1
How can I implement an interactive websocket client with autobahn asyncio?
1
Python: combining cmd and asyncio (for WAMP / autobahn)
0
sendMessage externally in autobahn runs in a separate thread using "asyncio"
0
Asyncio Autobahn behind reverse proxy rejects connection
0
How to connect telegram api using sock5



All Articles
Loading...
X
Show
Funny
Dev
Pics