diff --git a/src/paho/mqtt/client.py b/src/paho/mqtt/client.py index 4ccc8696..b6897751 100644 --- a/src/paho/mqtt/client.py +++ b/src/paho/mqtt/client.py @@ -4612,7 +4612,7 @@ def _create_socket(self) -> SocketLike: sock = self._ssl_wrap_socket(sock) if self._transport == "websockets": - sock.settimeout(self._keepalive) + sock.settimeout(self._connect_timeout) return _WebsocketWrapper( socket=sock, host=self._host, @@ -4667,7 +4667,7 @@ def _ssl_wrap_socket(self, tcp_sock: _socket.socket) -> ssl.SSLSocket: if getattr(self._ssl_context, 'check_hostname', False): # type: ignore verify_host = False - ssl_sock.settimeout(self._keepalive) + ssl_sock.settimeout(self._connect_timeout) ssl_sock.do_handshake() if verify_host: