refactoring to introduce ping
Adding PING support. Permitting empty client id, and improving client id validation and on-disk representation.