Fixed error "socket closed before connected"

Replaced setInterval with setTimeout and removed related
stopReconnection logic. Resolved warning caused by connection closing on
open.