fixed connect and disconnect events, added socket status tracking