Skip to content

Commit

Permalink
lws-meta: add var in js to enable and disable by default
Browse files Browse the repository at this point in the history
  • Loading branch information
lws-team committed Sep 25, 2017
1 parent be4bed5 commit aaf2bf6
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions test-apps/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,12 @@
* These helpers are defined in lws-common.js
*/

var use_lws_meta = 0, lws_meta;

var lws_meta = new lws_meta_ws();
lws_meta.new_parent(get_appropriate_ws_url("?mirror=" + mirror_name));
if (use_lws_meta) {
lws_meta = new lws_meta_ws();
lws_meta.new_parent(get_appropriate_ws_url("?mirror=" + mirror_name));
}


document.getElementById("number").textContent = get_appropriate_ws_url(mirror_name);
Expand All @@ -557,7 +560,12 @@
* the connection using just new_ws()
*/

var socket_di = lws_meta.new_ws("", "dumb-increment-protocol");
var socket_di;

if (use_lws_meta)
socket_di = lws_meta.new_ws("", "dumb-increment-protocol");
else
socket_di = new_ws(get_appropriate_ws_url(""), "dumb-increment-protocol");

try {
socket_di.onopen = function() {
Expand All @@ -581,8 +589,10 @@

var socket_status, jso, s;


socket_status = lws_meta.new_ws(get_appropriate_ws_url(""), "lws-status");
if (use_lws_meta)
socket_status = lws_meta.new_ws("", "lws-status");
else
socket_status = new_ws(get_appropriate_ws_url(""), "lws-status");

try {
socket_status.onopen = function() {
Expand Down Expand Up @@ -648,8 +658,10 @@
var socket_ot;

function ot_open() {

socket_ot = lws_meta.new_ws(get_appropriate_ws_url(""), "dumb-increment-protocol");
if (use_lws_meta)
socket_ot = lws_meta.new_ws(get_appropriate_ws_url(""), "dumb-increment-protocol");
else
socket_ot = new_ws(get_appropriate_ws_url(""), "dumb-increment-protocol");

console.log("ot_open");

Expand Down Expand Up @@ -697,9 +709,12 @@
var pending = "";
var lm_timer;

socket_lm = lws_meta.new_ws(get_appropriate_ws_url("?mirror=" + mirror_name),
if (use_lws_meta)
socket_lm = lws_meta.new_ws(get_appropriate_ws_url("?mirror=" + mirror_name),
"lws-mirror-protocol");
else
socket_lm = new_ws(get_appropriate_ws_url("?mirror=" + mirror_name),
"lws-mirror-protocol");

try {
socket_lm.onopen = function() {
document.getElementById("wslm_statustd").style.backgroundColor = "#40ff40";
Expand Down

0 comments on commit aaf2bf6

Please sign in to comment.