-
-
Notifications
You must be signed in to change notification settings - Fork 549
Description
I would like to retry making a connection when the remote is not listening on the port. This is a common use case for iTerm2's Python API, where scripts would like to launch the app and then connect to it once it has started.
Currently, when I do websockets.connect() and the remote isn't listening on the port it fails with OSError
with arguments of Multiple exceptions: [Errno 61] Connect call failed ('::1', 1912, 0, 0), [Errno 61] Connect call failed ('127.0.0.1', 1912)
My current approach is to catch OSError
and assume it is a connection failure that should be retried, but I'm sure there are other possible causes of OSError
.
I see that websockets defines many exceptions: https://websockets.readthedocs.io/en/stable/api.html#websockets.exceptions.ConnectionClosed
My request is to add websockets.exceptions.ConnectionRefused(remotes)
, where remotes
could hold the list of (ip,port) tuples.