You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by jo...@apache.org on 2009/06/01 18:05:20 UTC
svn commit: r780700 -
/incubator/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js
Author: johnh
Date: Mon Jun 1 16:05:19 2009
New Revision: 780700
URL: http://svn.apache.org/viewvc?rev=780700&view=rev
Log:
Only do early-rpc queueing when opted-in by a query param. This essentially disables the functionality for now. While I'd tested it to work on each transport, in-the-field reports suggest that this may break rpc on a few browsers and in some timing-sensitive scenarios (eg. different ordering of code than in the rpc profile/test harness; still being analyzed). Thus this change restores the status quo and mitigates risk.
Modified:
incubator/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js
Modified: incubator/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js?rev=780700&r1=780699&r2=780700&view=diff
==============================================================================
--- incubator/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js (original)
+++ incubator/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js Mon Jun 1 16:05:19 2009
@@ -95,6 +95,13 @@
authToken['..'] = params.rpctoken || params.ifpctok || 0;
+ // Indicates whether to support early-message queueing, which is designed
+ // to ensure that all messages sent by gadgets.rpc.call, irrespective
+ // when they were made (before/after setAuthToken, before/after transport
+ // setup complete), are sent. Hiding behind a query param to allow opt-in
+ // for a time while this technique is proven.
+ var useEarlyQueueing = (params['rpc_earlyq'] === "1");
+
/*
* Return a transport representing the best available cross-domain
* message-passing mechanism available to the browser.
@@ -131,7 +138,8 @@
receiverTx[receiverId] = tx;
// If there are any early-queued messages, send them now directly through
- // the needed transport.
+ // the needed transport. This queue will only have contents if
+ // useEarlyQueueing === true (see call method).
var earlyQueue = earlyRpcQueue[receiverId] || [];
for (var i = 0; i < earlyQueue.length; ++i) {
var rpc = earlyQueue[i];
@@ -524,7 +532,7 @@
}
// Attempt to make call via a cross-domain transport.
- var channel = receiverTx[targetId];
+ var channel = useEarlyQueueing ? receiverTx[targetId] : transport;
if (!channel) {
// Not set up yet. Enqueue the rpc for such time as it is.