+ flush_out_queue: function() {
+ var l_out = this.out_queue.length;
+ if (l_out == 0)
+ return;
+
+ for (var i = 0 ; i < l_out ; i++) {
+ if (this.ws.readyState != 1) {
+ break;
+ }
+ var item = this.out_queue.shift();
+ var sent = true;
+ try {
+ this.ws.send(item);
+ }
+ catch (ex) {
+ this.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.flush_out.push(msg);
+ }
+ }
+ else {
+ console.log('ws not ready: push into flush_out');
+ this.flush_out.push(msg);
+ }
+ },
+