|
@@ -1,5 +1,11 @@
|
1
|
1
|
"use strict";
|
2
|
2
|
|
|
3
|
+// makestache template info
|
|
4
|
+// the following string tells my make scripts its fine to overwtite this the library would have had a template str in the middle of the str
|
|
5
|
+// BUILT_FILE_OVERWRITE_ALLOWED
|
|
6
|
+// ... C:\ws\repos\jitsi_main\jsync\jsyncdb\js_client\jsync_lib.js
|
|
7
|
+// /* */
|
|
8
|
+
|
3
|
9
|
(function (){
|
4
|
10
|
var isProxy,tlu,msto_z
|
5
|
11
|
var pf,msto_prx
|
|
@@ -383,16 +389,7 @@ window.glob_u.ws.fns.onclose = function onclose(event){
|
383
|
389
|
clog("WS_CLOSE",{that:this,readyState:this.readyState,args:[...arguments]})
|
384
|
390
|
// glob_u.ws.sockets.ws1.params.ord.run_cbs("WS_CLOSE:",{event,that:this})
|
385
|
391
|
glob_u.ws.sockets[this.params.socket_name].params.ord.run_cbs("WS_CLOSE:",{event,that:this})
|
386
|
|
- let timeout0 = this.params.timeout0 || 100
|
387
|
|
- let timeout_multi = this.params.timeout_multi || 3000
|
388
|
|
- let t =timeout_multi
|
389
|
|
- // let now = Date.now()
|
390
|
|
- if (this.params.HAS_OPENED && timeout_multi<Date.now()-this.params.OPEN_TIME){
|
391
|
|
- t=timeout0
|
392
|
|
- }
|
393
|
|
- // clog(":TIME:",now,this.params.OPEN_TIME,now-this.params.OPEN_TIME)
|
394
|
|
- this.params.HAS_OPENED = 0
|
395
|
|
- setTimeout(this.params.fns.reconnect,t)
|
|
392
|
+ setTimeout(this.params.fns.reconnect,1000)
|
396
|
393
|
}
|
397
|
394
|
|
398
|
395
|
window.glob_u.ws.fns.onmessage = function onmessage(event){
|
|
@@ -409,10 +406,8 @@ window.glob_u.ws.fns.onerror = function onerror(event){
|
409
|
406
|
|
410
|
407
|
}
|
411
|
408
|
window.glob_u.ws.fns.onopen = function onopen(event){
|
412
|
|
- this.params.HAS_OPENED = 1
|
413
|
|
- this.params.OPEN_TIME = Date.now()
|
414
|
409
|
|
415
|
|
- clog("WS_OPEN???",{that:this,args:[...arguments]},{on_open_once:this.on_open_once,on_open_cbs:this.params.on_open_cbs})
|
|
410
|
+ // clog("WS_OPEN???",{that:this,args:[...arguments]},{on_open_once:this.on_open_once,on_open_cbs:this.params.on_open_cbs})
|
416
|
411
|
// glob_u.ws.sockets.ws1.params.ord.run_cbs("WS_OPEN:",{event,that:this})
|
417
|
412
|
glob_u.ws.sockets[this.params.socket_name].params.ord.run_cbs("WS_OPEN:",{event,that:this})
|
418
|
413
|
return
|
|
@@ -473,19 +468,6 @@ window.glob_u.ws.fns.ws_fns_factory = function ws_fns_factory(socket_opts){
|
473
|
468
|
return fns
|
474
|
469
|
}
|
475
|
470
|
|
476
|
|
-Object.defineProperty(window,'a',{
|
477
|
|
- get: function(){
|
478
|
|
- console.log('windowProperty is being get...',arguments);
|
479
|
|
- glob_u.ws.sockets.ws1.send(`{"a":2.01}`)
|
480
|
|
- return 'windowProperty'
|
481
|
|
- },
|
482
|
|
-
|
483
|
|
- set: function(val){
|
484
|
|
- console.log('windowProperty is being set',arguments);
|
485
|
|
- },
|
486
|
|
-
|
487
|
|
- configurable: true,
|
488
|
|
-});
|
489
|
471
|
|
490
|
472
|
function connect_ws(o= {}){
|
491
|
473
|
// clog("connect_ws:",o,jc(o))
|
|
@@ -501,19 +483,7 @@ function connect_ws(o= {}){
|
501
|
483
|
return
|
502
|
484
|
|
503
|
485
|
}
|
504
|
|
- var old_url = o.url
|
505
|
|
- // location.protocol == "https:" ? clog("HTTPS") : clog("HTTP?")
|
506
|
|
- // let vx1
|
507
|
|
- // let vx1;location.protocol == "https:" ? vx1 = "HTTPS" : vx1 = "HTTP?"
|
508
|
|
- // clog("VAR DECS",vx1)
|
509
|
|
- // o.url = "ws://127.0.0.1:5000/djc_srv/ws/chat/"
|
510
|
|
- // o.url = "ws://127.0.0.1:5000/djc_srv/ws/chat"
|
511
|
|
- // o.url = "ws://127.0.0.1:5000/echo_c1"
|
512
|
|
- // o.url = `ws://${location.hostname}:5000/echo_c1?HELLO__________________________________________________________________________=1`
|
513
|
|
- // o.url = `ws://${location.hostname}:5000/echo_c1${location.search}`
|
514
|
|
- // o.url = `ws://${location.hostname}:5000/echo_c1?HELLO+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=1`
|
515
|
|
- clog("new WebSocket(o.url)",o,o.url,old_url)
|
516
|
|
- // var socket = new WebSocket(o.url,["PROTOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"])
|
|
486
|
+
|
517
|
487
|
var socket = new WebSocket(o.url)
|
518
|
488
|
socket.on_open_once = []
|
519
|
489
|
socket.pre_init_msgs = []
|
|
@@ -563,11 +533,6 @@ function create_ws_ord(){
|
563
|
533
|
window.glob_u.ws.fns.dispatch = function dispatch(o,obj_x,info){
|
564
|
534
|
var event = o.event
|
565
|
535
|
// socket = o.that
|
566
|
|
- if (event.data == "::CLOSE::"){
|
567
|
|
- clog("comand_CLOSE!!!")
|
568
|
|
- o.that.close()
|
569
|
|
- }
|
570
|
|
- // clog(":event.data:",event.data,[this,o,obj_x,info])
|
571
|
536
|
var data = JSON.parse(event.data)
|
572
|
537
|
// clog("WS_dispatch",data,socket.params.ord,data["CLIENT_KEY"])
|
573
|
538
|
// clog("trc:sto:ws_rec",data.CLIENT_KEY,data.sto_event_type,data)
|
|
@@ -610,34 +575,6 @@ function ws_reload(){
|
610
|
575
|
|
611
|
576
|
|
612
|
577
|
function get_room_name(){
|
613
|
|
- // return
|
614
|
|
- var s=location.search
|
615
|
|
- // if s[0]=="?"){}
|
616
|
|
- s[0]=="?" ? s = s.slice(1):0
|
617
|
|
- var param
|
618
|
|
- for (param of s.split("&")){
|
619
|
|
-
|
620
|
|
- let kv = param.split("=")
|
621
|
|
- if (kv[0]=="room"){
|
622
|
|
- return kv[1]
|
623
|
|
- }
|
624
|
|
- clog("::",param,kv)
|
625
|
|
- // clog("::",param,kv,"")
|
626
|
|
- }
|
627
|
|
-
|
628
|
|
- // var
|
629
|
|
- return "room_name"
|
630
|
|
- var room_name=location.pathname.match(/\/loc.([^\/]*)\//)
|
631
|
|
- if (room_name){
|
632
|
|
- room_name = room_name[1]
|
633
|
|
- } else {
|
634
|
|
- room_name = location.pathname.split("/").pop()
|
635
|
|
-
|
636
|
|
- }
|
637
|
|
- return room_name
|
638
|
|
-
|
639
|
|
-}
|
640
|
|
-function get_room_name_old(){
|
641
|
578
|
|
642
|
579
|
var room_name=location.pathname.match(/\/loc.([^\/]*)\//)
|
643
|
580
|
if (room_name){
|
|
@@ -754,22 +691,14 @@ function mhndlr_rld_2(_o,scope,info){
|
754
|
691
|
if (glob_u.prom.init_db_resolve.resolved_inited == 2){
|
755
|
692
|
|
756
|
693
|
tmsgx4({sto_event_type:"db_sync_response",payload:jc(pf.root),request_from:parsed.from,request_rn_from:parsed.request_rn,"CLIENT_KEY":"ws_sto"})
|
757
|
|
- clog("SENDING!@#$%^&*(")
|
758
|
694
|
}
|
759
|
695
|
|
760
|
696
|
break;
|
761
|
697
|
case "db_sync_response":
|
762
|
698
|
|
763
|
|
- // clog("PROC db_sync_response",parsed,_o)
|
764
|
|
-
|
765
|
699
|
if (glob_u.prom.init_db_resolve && parsed.request_rn_from == glob_u.prom.init_db_resolve.rn){
|
766
|
|
- // clog("::PROC db_sync_response::",parsed,_o)
|
767
|
700
|
glob_u.prom.init_db_resolve({aaa:"dsr",pl:parsed.payload})
|
768
|
|
- } else {
|
769
|
|
- // clog("NO PROC::PROC db_sync_response::",parsed,_o)
|
770
|
|
-
|
771
|
701
|
}
|
772
|
|
- clog("::PROC db_sync_response::",glob_u.prom.init_db_resolve.rn==parsed.request_rn_from,glob_u.prom.init_db_resolve.rn,parsed.request_rn_from,parsed,_o)
|
773
|
702
|
// clog("db_sync_response",parsed)
|
774
|
703
|
break;
|
775
|
704
|
|
|
@@ -1366,7 +1295,6 @@ function handle_pre_init_msgs(){
|
1366
|
1295
|
}
|
1367
|
1296
|
|
1368
|
1297
|
function ws_sto_connected(a,b){
|
1369
|
|
- // clog("")
|
1370
|
1298
|
|
1371
|
1299
|
glob_u.cb.ws.run_cbs("WS_MSTO_INITED")
|
1372
|
1300
|
|
|
@@ -1617,24 +1545,17 @@ ensure_jsync_id_is_set(sessionStorage,"jsync_session")
|
1617
|
1545
|
|
1618
|
1546
|
// TODO:Fix bug caused by a user disconnecting before the connection is properly established
|
1619
|
1547
|
function connection_info_handler(o,scope,info){
|
1620
|
|
- // clog("**************************************************************8:",o,scope,info)
|
1621
|
1548
|
if (o.data.sto_event_type=="connection_info"){
|
1622
|
|
- clog("connection_info_handler:",o,scope,info)
|
|
1549
|
+ // clog("connection_info_handler:",o,scope,info)
|
1623
|
1550
|
glob_u.data.group_name = o.data.group_name
|
1624
|
1551
|
glob_u.data.channel_name = o.data.channel_name
|
1625
|
1552
|
clog("jsyncdb connected","room name:",glob_u.data.group_name)
|
1626
|
1553
|
} else if (o.data.sto_event_type=="user_disconnected"){
|
1627
|
|
- clog("user_disconnected_handler:",o,scope,info)
|
1628
|
|
-
|
1629
|
1554
|
var last_conn =1
|
1630
|
1555
|
var k,v
|
1631
|
1556
|
var ws_conn_data = jc(msto.ws_channels[o.data.channel_name])
|
1632
|
1557
|
delete msto.ws_channels[o.data.channel_name]
|
1633
|
1558
|
for ([k,v] of Object.entries(msto.ws_channels)){
|
1634
|
|
- clog("ERR!",{channel_name:jc(o.data.channel_name),ws_channels:jc(msto.ws_channels),z:{o,data:o.data}})
|
1635
|
|
- clog("ERR?",k,v,ws_conn_data)
|
1636
|
|
- clog("ERR??",jc(msto.ws_channels))
|
1637
|
|
- clog("ERR???",jc(o.data))
|
1638
|
1559
|
if (v.id == ws_conn_data.id){
|
1639
|
1560
|
last_conn = 0
|
1640
|
1561
|
}
|
|
@@ -1682,14 +1603,15 @@ glob_u.fns.get_session_sto_id = get_session_sto_id
|
1682
|
1603
|
// console.log("??...")
|
1683
|
1604
|
|
1684
|
1605
|
|
1685
|
|
-// clog("?????")
|
|
1606
|
+// clog("???")
|
1686
|
1607
|
//
|
1687
|
1608
|
|
1688
|
1609
|
|
1689
|
1610
|
|
|
1611
|
+
|
1690
|
1612
|
// glob_u.fns.get_room_name=get_room_name
|
1691
|
1613
|
// window.ds_test=ds_test
|
1692
|
1614
|
// glob_u.fns.ds_test=ds_test
|
1693
|
1615
|
// window.msto_prx=msto_prx
|
1694
|
1616
|
|
1695
|
|
-})()
|
|
1617
|
+})()
|