proxystore.p2p.client
Functions for connecting to the Signaling Server.
connect
async
¶
connect(
address: str,
uuid: UUID | None = None,
name: str | None = None,
timeout: float = 10,
ssl: ssl.SSLContext | None = None,
) -> tuple[UUID, str, WebSocketClientProtocol]
Establish client connection to a Signaling Server.
Parameters:
-
address
(
str
) –Address of the Signaling Server. Should start with ws:// or wss://.
-
uuid
(
UUID | None
) –Optional uuid of client to use when registering with signaling server.
-
name
(
str | None
) –Readable name of the client to use when registering with the signaling server. By default the hostname will be used.
-
timeout
(
float
) –Time to wait in seconds on server connections.
-
ssl
(
ssl.SSLContext | None
) –When None, the correct value to pass to :code:
websockets.connect
is inferred fromaddress
. Ifaddress
starts with "wss://" the value is True, otherwise is False. Optionally provide a custom SSLContext (useful if the server uses self-signed certificates).
Returns:
-
tuple[UUID, str, WebSocketClientProtocol]
–Tuple of the UUID of this client returned by the signaling server, the name used to register the client, and the websocket connection to the signaling server.
Raises:
-
EndpointRegistrationError
–If the connection to the signaling server is closed, does not reply to the registration request within the timeout, or replies with an error.
-
ValueError
–If address does not start with "ws://" or "wss://".