+ flush_out_queue: function() {
+ var l_out = this.xynt_streaming.out_queue.length;
+
+ if (l_out == 0)
+ return;
+
+ console.log('flush_out_queue: ' + l_out);
+ for (var i = 0 ; i < l_out ; i++) {
+ if (this.ws.readyState != 1) {
+ break;
+ }
+ var item = this.xynt_streaming.out_queue.shift();
+ var sent = true;
+ try {
+ this.ws.send(item);
+ }
+ catch (ex) {
+ this.xynt_streaming.out_queue.unshift(item);
+ break;
+ }
+ }
+ },
+
+ send: function(msg) {
+ console.log('new send');
+ if (this.ws && this.ws.readyState == 1) {
+ try {
+ console.log('Try send ... ');
+ this.flush_out_queue();
+ this.ws.send(msg);
+ console.log(' ... done');
+ }
+ catch (ex) {
+ console.log(' ... catched exception');
+ this.xynt_streaming.out_queue.push(msg);
+ }
+ }
+ else {
+ console.log('ws not ready: push into out_queue');
+ this.xynt_streaming.out_queue.push(msg);
+ }
+ },
+