Removing the second call of onEnd, I think its the source of the reconnect issues.