   Serial.println("onConnect called");
 }
 
+void onDisconnect(WebSocket &socket) {
+  Serial.println("onDisconnect 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 onData(WebSocket &socket, char* dataString, byte frameLength) {
-  
+
 #ifdef DEBUG
   Serial.print("Got data: ");
   Serial.write((unsigned char*)dataString, frameLength);
   Serial.println();
 #endif
-  
+
   if (frameLength == 13)
   {
     Serial.println("Type A: 10 pole DIP switches");

void loop() {
  // Should be called for each loop.
  wsServer.listen();
  
  // Do other stuff here, but don't hang or cause long delays.
  delay(100);
  //if (wsServer.isConnected()) {
    //wsServer.send("abc123", 6);
  //}
  
  //reset watchdog timer
  wdt_reset();
}

    Serial.print("Off: ");
    mySwitch.switchOff(systemcode, unitcode);
  }

  Serial.print(systemcode);
  Serial.print(",");
  Serial.println(unitcode);
}

/*
 * Type B: Two rotary/sliding switches
 */
void switchTypeB(char* dataString)
{
  if (dataString[0] == '1')
