Added on connect function for connection socket that is missing in some cases.