thinger-io / Arduino-Library

IOTMP Arduino Library for connecting devices to thinger.io #IoT
https://thinger.io
MIT License
114 stars 66 forks source link

Latest change has a constant Socket Connection Error #36

Closed BottledLunacy closed 3 years ago

BottledLunacy commented 3 years ago

Hi,

I just updated to 2.16.0 and can no longer connect. To debug the error, I've overridden the ClientListener class and added some Serial.println statements for each connection state and connecting just gets stuck on Socket Connection Error. My code has not changed and worked just great with the previous lib version I had installed.

Any suggestions?

Thanks, Roger

class ClientListener : public ThingerESP32{ public: ClientListener(const char user, const char device, const char* device_credential) : ThingerESP32(user, device, device_credential){}

bool NETWORK_CONNECT_STATUS_ERROR = false;
bool NETWORK_CONNECT_STATUS_CONNECTED = false;
bool Thing_Connected = false;
bool WifiConnected = false;
bool thing_NETWORK_CONNECTING = false;
bool thing_SOCKET_CONNECTING = false;
bool thing_SOCKET_TIMEOUT = false;

protected: virtual void thinger_state_listener(THINGER_STATE state){ // call current implementation (debug) ThingerESP32::thinger_state_listener(state); switch(state){ case NETWORK_CONNECTING: thing_NETWORK_CONNECTING = true; Serial.println("Network Connecting"); break; case NETWOR K_CONNECTED: WifiConnected = true; Serial.println("Wifi Connected"); break; case NETWORK_CONNECT_ERROR: NETWORK_CONNECT_STATUS_ERROR = true; Serial.println("Network connect status error"); break; case SOCKET_CONNECTING: Serial.println("Socket Connecting"); thing_SOCKET_CONNECTING; break; case SOCKET_CONNECTED: Serial.println("Socked Connected");
break; case SOCKET_CONNECTION_ERROR: Serial.println("Socked Connection Error");
break; case SOCKET_DISCONNECTED: Serial.println("Socket disconnected"); break; case SOCKET_TIMEOUT: thing_SOCKET_TIMEOUT; Serial.println("Socked timeout"); break; case THINGER_AUTHENTICATING: Serial.println("Authenticating"); break; case THINGER_AUTHENTICATED:x Serial.println("Authenticated"); Thing_Connected = true; break; case THINGER_AUTH_FAILED: Serial.println("Auth Failed"); break; case THINGER_STOP_REQUEST: Serial.println("Stop Request"); break;
default: // turn off your led break; } } };

ClientListener thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);

alvarolb commented 3 years ago

Hi, it should be working with Library version 2.17.0!