How to access a Unix Socket with socketio-python #1454
-
Hello, I'm searching in the documentation a way to connect as Client to a Unix Socket My Server : def __init__():
self.sio = socketio.AsyncServer(async_mode="aiohttp")
self.app = web.Application()
self.sio.attach(self.app)
async def run(self) -> None:
path_to_unix_socket = '/tmp/websockets.web.sock'
if os.path.exists(path_to_unix_socket):
os.remove(path_to_unix_socket)
# Setup Unix Socket
runner = web.AppRunner(self.app)
await runner.setup()
site = web.UnixSite(runner, path_to_unix_socket)
await site.start()
while not self.closed:
await asyncio.sleep(1)
_logger.info("(Websocket) Cleaning up...")
await runner.cleanup() Thanks ! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@lupaulus I assume the question is about using the Python Socket.IO client for this? This is currently not a supported option, just because this package uses URLs to make connections and it currently has no knowledge of how to form HTTP and WebSocket URLs that reference a UNIX domain socket. I suppose this is possible to add, but I honestly don't know what URLs should look like, and if the third-party packages that I use for low-level HTTP and WebSocket connections support them. |
Beta Was this translation helpful? Give feedback.
@lupaulus I assume the question is about using the Python Socket.IO client for this? This is currently not a supported option, just because this package uses URLs to make connections and it currently has no knowledge of how to form HTTP and WebSocket URLs that reference a UNIX domain socket. I suppose this is possible to add, but I honestly don't know what URLs should look like, and if the third-party packages that I use for low-level HTTP and WebSocket connections support them.