                 DFORMAT("[WSc] Connected to url: %s\n\r",  payload);
                 isConnected = true;
 
-			    // send message to server when Connected
-                // socket.io upgrade confirmation message (required)
-				webSocket.sendTXT("5");
+                DLN("Sending Subscription");
+                isSubscribed = false;
             }
             break;
         case WStype_TEXT:


  while (isConnected) {
    webSocket.loop();
    DFORMAT("RAM Memory left: %d\r\n", ESP.getFreeHeap());
  
    uint64_t now = millis();

    if(now - messageTimestamp > MESSAGE_INTERVAL) {
      messageTimestamp = now;

      DLN("Sending testRead");
      webSocket.sendTXT(testRead);
    }
    if((now - heartbeatTimestamp) > HEARTBEAT_INTERVAL) {
      heartbeatTimestamp = now;





void loop() {
    
  // if not connected try to connect
