Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

jsync_2nd_db.js 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. clog=console.log
  2. clog("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
  3. function jsyncdb_init_helper_v2(){
  4. // clog("WS_HELPER")
  5. var fns = window.glob_u.ws.fns
  6. var room_name=glob_u.fns.get_room_name()
  7. let ws_protocol = "wss:"
  8. location.protocol == "https:" ? "was already set to wss:" : ws_protocol = "ws:"
  9. var o = {
  10. include_participants_data:1,
  11. include_ws_channel_data:1, // required for participants_data to work
  12. // msto.participants and msto.ws_channels will be defined in either case so we don't need to handle cases where some users enable this and some don't
  13. AutoReconnect:false,
  14. // the following options attributes
  15. url:'wss://' + window.location.hostname +`/djc_srv/ws/chat/${room_name}`,
  16. url: `${ws_protocol}//${location.hostname}:5000/echo_c1${location.search}`,
  17. url: `${ws_protocol}//${location.hostname}:5000/echo_c1?room=a2z`,
  18. socket_name:"a2z",
  19. ord:glob_u.cb.ws,
  20. methods:{
  21. onmessage:fns.onmessage,
  22. onclose:fns.onclose,
  23. onerror:fns.onerror,
  24. onopen:fns.onopen,
  25. },
  26. fns:{
  27. },
  28. }
  29. var socket = window.glob_u.fns.connect_ws(o)
  30. // clog({socket})
  31. return socket
  32. }
  33. // var socket = new WebSocket(http://127.0.0.1:5000/?room=ax3)