mirror of
https://github.com/Links2004/arduinoWebSockets.git
synced 2025-07-13 23:36:30 +02:00
fix #541 allow loop() to be called before begin()
This commit is contained in:
@ -31,6 +31,8 @@ WebSocketsClient::WebSocketsClient() {
|
||||
_client.cIsClient = true;
|
||||
_client.extraHeaders = WEBSOCKETS_STRING("Origin: file://");
|
||||
_reconnectInterval = 500;
|
||||
_port = 0;
|
||||
_host = "";
|
||||
}
|
||||
|
||||
WebSocketsClient::~WebSocketsClient() {
|
||||
@ -148,6 +150,9 @@ void WebSocketsClient::beginSocketIOSSLWithCA(const char * host, uint16_t port,
|
||||
* called in arduino loop
|
||||
*/
|
||||
void WebSocketsClient::loop(void) {
|
||||
if(_port == 0) {
|
||||
return;
|
||||
}
|
||||
WEBSOCKETS_YIELD();
|
||||
if(!clientIsConnected(&_client)) {
|
||||
// do not flood the server
|
||||
|
Reference in New Issue
Block a user