MCPcopy Create free account
hub / github.com/python-websockets/websockets / unix_connect

Function unix_connect

src/websockets/sync/client.py:395–422  ·  view source on GitHub ↗

Connect to a WebSocket server listening on a Unix socket. This function accepts the same keyword arguments as :func:`connect`. It's only available on Unix. It's mainly useful for debugging servers listening on Unix sockets. Args: path: File system path to the Unix so

(
    path: str | None = None,
    uri: str | None = None,
    **kwargs: Any,
)

Source from the content-addressed store, hash-verified

393
394
395def unix_connect(
396 path: str | None = None,
397 uri: str | None = None,
398 **kwargs: Any,
399) -> ClientConnection:
400 """
401 Connect to a WebSocket server listening on a Unix socket.
402
403 This function accepts the same keyword arguments as :func:`connect`.
404
405 It's only available on Unix.
406
407 It's mainly useful for debugging servers listening on Unix sockets.
408
409 Args:
410 path: File system path to the Unix socket.
411 uri: URI of the WebSocket server. ``uri`` defaults to
412 ``ws://localhost/`` or, when a ``ssl`` is provided, to
413 ``wss://localhost/``.
414
415 """
416 if uri is None:
417 # Backwards compatibility: ssl used to be called ssl_context.
418 if kwargs.get("ssl") is None and kwargs.get("ssl_context") is None:
419 uri = "ws://localhost/"
420 else:
421 uri = "wss://localhost/"
422 return connect(uri=uri, unix=True, path=path, **kwargs)
423
424
425try:

Callers 15

helloFunction · 0.90
test_connectionMethod · 0.90
test_connectionMethod · 0.90
test_connectionMethod · 0.90
test_connectionMethod · 0.90
test_connectionMethod · 0.50
test_set_host_headerMethod · 0.50

Calls 2

connectFunction · 0.70
getMethod · 0.45

Tested by 15

test_connectionMethod · 0.72
test_connectionMethod · 0.72
test_connectionMethod · 0.72
test_connectionMethod · 0.72
test_connectionMethod · 0.40
test_set_host_headerMethod · 0.40

Used in the wild real call sites across dependent graphs

searching dependent graphs…