From 6a76efa791046167d3a7cbbf94bed118cb6bee4f Mon Sep 17 00:00:00 2001 From: Links Date: Thu, 20 Jun 2019 10:06:21 +0200 Subject: [PATCH] fix #445 #446 set TCP timeout for ESP32 on connect --- src/WebSocketsClient.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/WebSocketsClient.cpp b/src/WebSocketsClient.cpp index 8d48ccd..e00a942 100644 --- a/src/WebSocketsClient.cpp +++ b/src/WebSocketsClient.cpp @@ -190,8 +190,11 @@ void WebSocketsClient::loop(void) { DEBUG_WEBSOCKETS("[WS-Client] creating Network class failed!"); return; } - +#if defined(ESP32) + if(_client.tcp->connect(_host.c_str(), _port, WEBSOCKETS_TCP_TIMEOUT)) { +#else if(_client.tcp->connect(_host.c_str(), _port)) { +#endif connectedCb(); _lastConnectionFail = 0; } else {