[Pkg-javascript-commits] [sockjs-client] 41/434: Renamed some transports, don't set devel/debug by default

Tonnerre Lombard tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:00 UTC 2014


This is an automated email from the git hooks/post-receive script.

tonnerre-guest pushed a commit to branch master
in repository sockjs-client.

commit ebbecd604a563299a4faec6eccc18edc18889dfe
Author: Marek Majkowski <majek04 at gmail.com>
Date:   Tue Aug 2 14:08:05 2011 +0100

    Renamed some transports, don't set devel/debug by default
---
 lib/main.js                                    | 3 +--
 lib/sockjs.js                                  | 9 +++++++--
 lib/{trans-jsonp.js => trans-jsonp-polling.js} | 2 +-
 lib/trans-websocket.js                         | 3 ---
 smoke-reconnect.html                           | 5 +++--
 smoke-throughput.html                          | 7 ++++---
 6 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/lib/main.js b/lib/main.js
index 836007c..6c99b7e 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -9,7 +9,7 @@ SockJS = (function(){
 <!-- include lib/trans-websocket.js -->
 <!-- include lib/trans-jsonp-sender.js -->
 <!-- include lib/trans-jsonp-receiver.js -->
-<!-- include lib/trans-jsonp.js -->
+<!-- include lib/trans-jsonp-polling.js -->
 <!-- include lib/trans-xhrpolling.js -->
 <!-- include lib/trans-iframe.js -->
 <!-- include lib/trans-iframe-within.js -->
@@ -18,4 +18,3 @@ SockJS = (function(){
                   return SockJS;
           })();
 if ('_sockjs_onload' in window) setTimeout(_sockjs_onload, 1);
-
diff --git a/lib/sockjs.js b/lib/sockjs.js
index e1d72e3..417afcf 100644
--- a/lib/sockjs.js
+++ b/lib/sockjs.js
@@ -1,6 +1,6 @@
 var SockJS = function(url, protocols, options) {
     var that = this;
-    that._options = {devel: true, debug: true};
+    that._options = {devel: false, debug: false};
     if (options) {
         utils.objectExtend(that._options, options);
     }
@@ -8,7 +8,12 @@ var SockJS = function(url, protocols, options) {
     that._server = that._options.server || utils.random_number_string(1000);
     that._connid = utils.random_string(8);
     that._trans_url = that._base_url + '/' + that._server + '/' + that._connid;
-    that._protocols = ['websocket', 'iframe-eventsource', 'iframe-htmlfile', 'jsonp'];
+    that._protocols = ['websocket',
+                       'xhr-multipart',
+                       'xhr-polling',
+                       'iframe-eventsource',
+                       'iframe-xhr-polling',
+                       'jsonp-polling'];
     switch(typeof protocols) {
     case 'undefined': break;
     case 'string': that._protocols = [protocols]; break;
diff --git a/lib/trans-jsonp.js b/lib/trans-jsonp-polling.js
similarity index 96%
rename from lib/trans-jsonp.js
rename to lib/trans-jsonp-polling.js
index 02bb5ae..29e9976 100644
--- a/lib/trans-jsonp.js
+++ b/lib/trans-jsonp-polling.js
@@ -7,7 +7,7 @@
 //   o for Konqueror a dumb timer is needed to detect errors
 
 
-var JsonPTransport = SockJS.jsonp = function(ri, trans_url){
+var JsonPTransport = SockJS['jsonp-polling'] = function(ri, trans_url) {
     utils.polluteGlobalNamespace();
     var that = this;
     that.ri = ri;
diff --git a/lib/trans-websocket.js b/lib/trans-websocket.js
index 301a48f..e65e915 100644
--- a/lib/trans-websocket.js
+++ b/lib/trans-websocket.js
@@ -10,9 +10,6 @@ var WebSocketTransport = SockJS.websocket = function(ri, trans_url) {
     that.url = url;
     var Constructor = window.WebSocket || MozWebSocket;
     that.ws = new Constructor(that.url);
-    that.ws.onopen = function(e) {
-        console.log('onopen');
-    };
     that.ws.onmessage = function(e) {
         that.ri._didMessage(e.data);
     };
diff --git a/smoke-reconnect.html b/smoke-reconnect.html
index 62a1e3d..364b961 100644
--- a/smoke-reconnect.html
+++ b/smoke-reconnect.html
@@ -42,6 +42,7 @@
 
 <script>
     sockjs_url += '/echo';
+    sockjs_opts = {devel:true, debug:false};
 
     function log(a) {
             if ('console' in window && 'log' in window.console) {
@@ -66,7 +67,7 @@
     function onclose(e) {
         if (started && e.status === 1000) {
             t0 = (new Date()).getTime();
-            sjs = new SockJS(sockjs_url, protocol);
+            sjs = new SockJS(sockjs_url, protocol, sockjs_opts);
             sjs.onopen = onopen
             sjs.onclose = onclose;
         } else {
@@ -84,8 +85,8 @@
 
     $('#connect').click(function() {
         started = true;
-        log('[starting]');
         protocol = $('#transport').val() || undefined;
+        log('[starting] ' + protocol);
         onclose({status:1000});
         $('#connect').attr('disabled', true);
         $('#disconnect').attr('disabled', false);
diff --git a/smoke-throughput.html b/smoke-throughput.html
index 0a7434c..a543769 100644
--- a/smoke-throughput.html
+++ b/smoke-throughput.html
@@ -42,6 +42,7 @@
 
 <script>
     sockjs_url += '/echo';
+    sockjs_opts = {devel:true, debug:true};
 
     function log(a) {
             if ('console' in window && 'log' in window.console) {
@@ -76,11 +77,11 @@
     };
 
     $('#connect').click(function() {
-        log('[connecting]');
         $('#connect').attr('disabled', true);
         $('#disconnect').attr('disabled', false);
-        var t = $('#transport').val() || undefined;
-        sjs = new SockJS(sockjs_url, t);
+        var protocol = $('#transport').val() || undefined;
+        log('[connecting] ' + protocol);
+        sjs = new SockJS(sockjs_url, protocol, sockjs_opts);
         sjs.onopen = onopen
         sjs.onclose = onclose;
         sjs.onmessage = onmessage;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git



More information about the Pkg-javascript-commits mailing list