// FILE:WS0 // TODO:JFI this file probably causes memory leaks window.glob_u.ws = window.glob_u.ws || { sockets:{}, fns:{}, flags:{}, } window.glob_u.trc = window.glob_u.trc || { arr:[], } // TODO:JFI I should factor out my development junk function trc_sto(s,o){ if (!glob_u?.prom?.init_db_resolve?.resolved){ var elm = {name:s,o,timestamp:Date.now()} glob_u.trc.arr.push(elm) // clog("_trc:sto",s,o.sto_event_type,elm.timestamp,o) } } window.glob_u.ws.fns.reconnect = function reconnect(o,close_event){ connect_ws(o.params) } // TODO:JFI These event handlers are less generic now window.glob_u.ws.fns.onclose = function onclose(event){ clog("WS_CLOSE",{that:this,readyState:this.readyState,args:[...arguments]}) // glob_u.ws.sockets.ws1.params.ord.run_cbs("WS_CLOSE:",{event,that:this}) glob_u.ws.sockets[this.params.socket_name].params.ord.run_cbs("WS_CLOSE:",{event,that:this}) // setTimeout(this.params.fns.reconnect,1000) let timeout0 = this.params.timeout0 || 100 let timeout_multi = this.params.timeout_multi || 3000 let t =timeout_multi // let now = Date.now() if (this.params.HAS_OPENED && timeout_multi