updated and tested socket lifecycle
updated and tested socket lifecycle

 - handles terminating the script with Ctrl-C (SIGINT)
 - sends last will and testament (LWT) with /connected == 'false'
 - other various fixups

idcrook/rpi-iot-demo-2017,idcrook/rpi-iot-demo-2017,idcrook/rpi-iot-demo-2017,idcrook/rpi-iot-demo-2017,idcrook/rpi-iot-demo-2017,idcrook/rpi-iot-demo-2017