   
   // Do other stuff here, but don't hang or cause long delays.
   delay(100);
-  if (wsServer.isConnected()) {
+  //if (wsServer.isConnected()) {
     //wsServer.send("abc123", 6);
-  }
+  //}
+  
+  //reset watchdog timer
+  wdt_reset();
 }

void onConnect(WebSocket &socket) {
  Serial.println("onConnect called");
}


// You must have at least one function with the following signature.
// It will be called by the server when a data frame is received.


void switchTypeA(char* dataString)
{
  char* state = strtok(dataString, ",");
  char* systemcode = strtok(NULL, ",");
  char* unitcode = strtok(NULL, ",");  
  
  if (dataString[0] == '1')
  {
    Serial.print("On: ");
    mySwitch.switchOn(systemcode, unitcode);
  }
  else
  {
    Serial.print("Off: ");
    mySwitch.switchOff(systemcode, unitcode);
  }
  
  Serial.print(systemcode);
  Serial.print(",");
  Serial.println(unitcode);
}

void switchTypeB(char* dataString)
{
  if (dataString[0] == '1')
  {
    Serial.print("On: ");
    mySwitch.switchOn(int(dataString[2]), int(dataString[4]));
  }
  else
  {
    Serial.print("Off: ");
    mySwitch.switchOff(int(dataString[2]), int(dataString[4]));
  }
  
  Serial.print(dataString[2]);
  Serial.print(",");
  Serial.println(dataString[4]);
}

void onDisconnect(WebSocket &socket) {
