if socket connects before on(connect) functions get exected in js then call them right away