|
|
@@ -389,7 +389,17 @@ window.glob_u.ws.fns.onclose = function onclose(event){
|
|
389
|
389
|
clog("WS_CLOSE",{that:this,readyState:this.readyState,args:[...arguments]})
|
|
390
|
390
|
// glob_u.ws.sockets.ws1.params.ord.run_cbs("WS_CLOSE:",{event,that:this})
|
|
391
|
391
|
glob_u.ws.sockets[this.params.socket_name].params.ord.run_cbs("WS_CLOSE:",{event,that:this})
|
|
392
|
|
- setTimeout(this.params.fns.reconnect,1000)
|
|
|
392
|
+ // setTimeout(this.params.fns.reconnect,1000)
|
|
|
393
|
+ let timeout0 = this.params.timeout0 || 100
|
|
|
394
|
+ let timeout_multi = this.params.timeout_multi || 3000
|
|
|
395
|
+ let t =timeout_multi
|
|
|
396
|
+ // let now = Date.now()
|
|
|
397
|
+ if (this.params.HAS_OPENED && timeout_multi<Date.now()-this.params.OPEN_TIME){
|
|
|
398
|
+ t=timeout0
|
|
|
399
|
+ }
|
|
|
400
|
+ // clog(":TIME:",now,this.params.OPEN_TIME,now-this.params.OPEN_TIME)
|
|
|
401
|
+ this.params.HAS_OPENED = 0
|
|
|
402
|
+ setTimeout(this.params.fns.reconnect,t)
|
|
393
|
403
|
}
|
|
394
|
404
|
|
|
395
|
405
|
window.glob_u.ws.fns.onmessage = function onmessage(event){
|
|
|
@@ -406,7 +416,9 @@ window.glob_u.ws.fns.onerror = function onerror(event){
|
|
406
|
416
|
|
|
407
|
417
|
}
|
|
408
|
418
|
window.glob_u.ws.fns.onopen = function onopen(event){
|
|
409
|
|
-
|
|
|
419
|
+ this.params.HAS_OPENED = 1
|
|
|
420
|
+ this.params.OPEN_TIME = Date.now()
|
|
|
421
|
+
|
|
410
|
422
|
// clog("WS_OPEN???",{that:this,args:[...arguments]},{on_open_once:this.on_open_once,on_open_cbs:this.params.on_open_cbs})
|
|
411
|
423
|
// glob_u.ws.sockets.ws1.params.ord.run_cbs("WS_OPEN:",{event,that:this})
|
|
412
|
424
|
glob_u.ws.sockets[this.params.socket_name].params.ord.run_cbs("WS_OPEN:",{event,that:this})
|
|
|
@@ -575,6 +587,35 @@ function ws_reload(){
|
|
575
|
587
|
|
|
576
|
588
|
|
|
577
|
589
|
function get_room_name(){
|
|
|
590
|
+ // return
|
|
|
591
|
+ var s=location.search
|
|
|
592
|
+ // if s[0]=="?"){}
|
|
|
593
|
+ s[0]=="?" ? s = s.slice(1):0
|
|
|
594
|
+ var param
|
|
|
595
|
+ for (param of s.split("&")){
|
|
|
596
|
+
|
|
|
597
|
+ let kv = param.split("=")
|
|
|
598
|
+ if (kv[0]=="room"){
|
|
|
599
|
+ return kv[1]
|
|
|
600
|
+ }
|
|
|
601
|
+ clog("::",param,kv)
|
|
|
602
|
+ // clog("::",param,kv,"")
|
|
|
603
|
+ }
|
|
|
604
|
+
|
|
|
605
|
+ // var
|
|
|
606
|
+ return "room_name"
|
|
|
607
|
+ var room_name=location.pathname.match(/\/loc.([^\/]*)\//)
|
|
|
608
|
+ if (room_name){
|
|
|
609
|
+ room_name = room_name[1]
|
|
|
610
|
+ } else {
|
|
|
611
|
+ room_name = location.pathname.split("/").pop()
|
|
|
612
|
+
|
|
|
613
|
+ }
|
|
|
614
|
+ return room_name
|
|
|
615
|
+
|
|
|
616
|
+}
|
|
|
617
|
+// function get_room_name(){
|
|
|
618
|
+function get_room_name_old(){
|
|
578
|
619
|
|
|
579
|
620
|
var room_name=location.pathname.match(/\/loc.([^\/]*)\//)
|
|
580
|
621
|
if (room_name){
|