You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Jordan Zimmerman <jo...@shop.com> on 2009/05/07 02:30:13 UTC
requestSendMessage()
I'd really like to see requestSendMessage() implemented via RPC ala
requestNavigateTo(). Others have suggested the same elsewhere. I've add
a Jira with a working implementation. FYI
https://issues.apache.org/jira/browse/SHINDIG-1049
Jordan Zimmerman
Principal Software Architect
831.647.4712
831.214.2990 (cell)
jordanz@shop.com
SHOP*COMTM
Shop Smart, Save Big(tm)
www.shop.com
This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this
message
immediately if this is an electronic communication.
Thank you.
Re: requestSendMessage(), setPrefs(), etc.
Posted by Tim Moore <tm...@atlassian.com>.
Set pref at least may need to communicate with the container. Most
containers that support user prefs provide some kind of form UI for
setting them. For example, look at iGoogle. If a gadget sets
preferences programatically, the container needs to update the form
with the new values, or else it will be out of sync.
I think a container that handles user prefs would probably want to
bypass Shindig when saving them and post to an endpoint within the
container directly (using the user's login cookie or equivalent for
authentication). That's what we're doing, anyway. We're not using
AppData for UserPrefs though, and we haven't implemented messages
either, so I can't speak to that.
-- Tim
On May 12, 2009, at 11:59 AM, Jordan Zimmerman wrote:
> As I've mentioned before, it seems odd to me to have set_pref() and
> requestSendMessage() implemented via RPC in the container. Both of
> these
> methods need to communicate with the server. How can this be done
> securely in the container? The container doesn't have access to
> OAuth or
> makeRequest().
>
> Jordan Zimmerman
> Principal Software Architect
> 831.647.4712
> 831.214.2990 (cell)
> jordanz@shop.com
>
> SHOP*COMTM
> Shop Smart, Save Big(tm)
> www.shop.com
>
> This message (including any attachments) is intended only for
> the use of the individual or entity to which it is addressed and
> may contain information that is non-public, proprietary,
> privileged, confidential, and exempt from disclosure under
> applicable law or may constitute as attorney work product.
> If you are not the intended recipient, you are hereby notified
> that any use, dissemination, distribution, or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, notify us immediately by telephone and
> (i) destroy this message if a facsimile or (ii) delete this
> message
> immediately if this is an electronic communication.
>
> Thank you.
requestSendMessage(), setPrefs(), etc.
Posted by Jordan Zimmerman <jo...@shop.com>.
As I've mentioned before, it seems odd to me to have set_pref() and
requestSendMessage() implemented via RPC in the container. Both of these
methods need to communicate with the server. How can this be done
securely in the container? The container doesn't have access to OAuth or
makeRequest().
Jordan Zimmerman
Principal Software Architect
831.647.4712
831.214.2990 (cell)
jordanz@shop.com
SHOP*COMTM
Shop Smart, Save Big(tm)
www.shop.com
This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this
message
immediately if this is an electronic communication.
Thank you.
RE: requestSendMessage()
Posted by Jordan Zimmerman <jo...@shop.com>.
This is now implemented and a working patch has been posted:
https://issues.apache.org/jira/browse/SHINDIG-1049
Jordan Zimmerman
Principal Software Architect
831.647.4712
831.214.2990 (cell)
jordanz@shop.com
SHOP*COMTM
Shop Smart, Save Big(tm)
www.shop.com
This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this
message
immediately if this is an electronic communication.
Thank you.
RE: requestSendMessage()
Posted by Jordan Zimmerman <jo...@shop.com>.
>>Depends on which browser you're using, but in general yes, that's
>>likely
>>the issue.
>I tried that - but same result. My callback never gets called.
Man - after debugging all fargin day I finally found the problem. I was
using the wrong hostname for the RPC relay registration inside the
gadget.
It's working now.
Jordan Zimmerman
Principal Software Architect
831.647.4712
831.214.2990 (cell)
jordanz@shop.com
SHOP*COMTM
Shop Smart, Save Big(tm)
www.shop.com
This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this
message
immediately if this is an electronic communication.
Thank you.
RE: requestSendMessage()
Posted by Jordan Zimmerman <jo...@shop.com>.
>Depends on which browser you're using, but in general yes, that's
likely
>the issue.
I tried that - but same result. My callback never gets called.
Jordan Zimmerman
Principal Software Architect
831.647.4712
831.214.2990 (cell)
jordanz@shop.com
SHOP*COMTM
Shop Smart, Save Big(tm)
www.shop.com
This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this
message
immediately if this is an electronic communication.
Thank you.
Re: requestSendMessage()
Posted by John Hjelmstad <fa...@google.com>.
Depends on which browser you're using, but in general yes, that's likely the
issue.
On Mon, May 11, 2009 at 7:52 PM, Jordan Zimmerman <jo...@shop.com> wrote:
> >In your container page, have you initialized each gadget (assuming it's
> an
>
> Yes, I'm making the setAuthToken/setRelayUrl calls. However, the target
> ID is different than the iframe ID. Is this a problem? I've debugged in
> and the targetUrl is being retrieved correctly.
>
> Jordan Zimmerman
> Principal Software Architect
> 831.647.4712
> 831.214.2990 (cell)
> jordanz@shop.com
>
> SHOP*COMTM
> Shop Smart, Save Big(tm)
> www.shop.com
>
>
> This message (including any attachments) is intended only for
> the use of the individual or entity to which it is addressed and
> may contain information that is non-public, proprietary,
> privileged, confidential, and exempt from disclosure under
> applicable law or may constitute as attorney work product.
> If you are not the intended recipient, you are hereby notified
> that any use, dissemination, distribution, or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, notify us immediately by telephone and
> (i) destroy this message if a facsimile or (ii) delete this
> message
> immediately if this is an electronic communication.
>
> Thank you.
>
RE: requestSendMessage()
Posted by Jordan Zimmerman <jo...@shop.com>.
>In your container page, have you initialized each gadget (assuming it's
an
Yes, I'm making the setAuthToken/setRelayUrl calls. However, the target
ID is different than the iframe ID. Is this a problem? I've debugged in
and the targetUrl is being retrieved correctly.
Jordan Zimmerman
Principal Software Architect
831.647.4712
831.214.2990 (cell)
jordanz@shop.com
SHOP*COMTM
Shop Smart, Save Big(tm)
www.shop.com
This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this
message
immediately if this is an electronic communication.
Thank you.
Re: requestSendMessage()
Posted by John Hjelmstad <fa...@google.com>.
In your container page, have you initialized each gadget (assuming it's an
IFRAME w/ <iframe id="gadget" name="gadget" src="
http://server.com/gadgets/ifr...stuff...#rpctoken=1234"/>) w/:
<script>
gadgets.rpc.setAuthToken('gadget', '1234');
gadgets.rpc.setRelayUrl('gadget', '
http://server.com/gadgets/files/container/rpc_relay.html');
</script>
? Apropos of some of some recent posts re: rpc.js, the relayUrl bit may not
be needed much longer, but depending on your browser/setup it is for now.
--John
On Mon, May 11, 2009 at 6:25 PM, Jordan Zimmerman <jo...@shop.com> wrote:
> >The callback should automatically resolve in the gadget since the
> >CALLBACK_NAME'd service is registered by default in rpc.js. Do _any_
> >gadgets.rpc calls work for you?
>
> They work one-way: from gadget to container. But not the other way.
>
> -Jordan
>
>
> This message (including any attachments) is intended only for
> the use of the individual or entity to which it is addressed and
> may contain information that is non-public, proprietary,
> privileged, confidential, and exempt from disclosure under
> applicable law or may constitute as attorney work product.
> If you are not the intended recipient, you are hereby notified
> that any use, dissemination, distribution, or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, notify us immediately by telephone and
> (i) destroy this message if a facsimile or (ii) delete this
> message
> immediately if this is an electronic communication.
>
> Thank you.
>
RE: requestSendMessage()
Posted by Jordan Zimmerman <jo...@shop.com>.
>The callback should automatically resolve in the gadget since the
>CALLBACK_NAME'd service is registered by default in rpc.js. Do _any_
>gadgets.rpc calls work for you?
They work one-way: from gadget to container. But not the other way.
-Jordan
This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this
message
immediately if this is an electronic communication.
Thank you.
Re: requestSendMessage()
Posted by John Hjelmstad <fa...@google.com>.
The callback should automatically resolve in the gadget since the
CALLBACK_NAME'd service is registered by default in rpc.js. Do _any_
gadgets.rpc calls work for you?
On Mon, May 11, 2009 at 5:16 PM, Jordan Zimmerman <jo...@shop.com> wrote:
> >What you're doing looks correct to me. Are you getting any errors when
> you
> >invoke the callback? What browser are you using?
>
> No, no errors. Also, I've debugged into the callback and I can see that
> the message is being posted. I'm using FF 3.0.10.
>
> Am I correct that I need to register to the callback in the gadget ala:
>
> gadgets.rpc.register(gadgets.rpc.CALLBACK_NAME, _my_handler);
>
> Jordan Zimmerman
> Principal Software Architect
> 831.647.4712
> 831.214.2990 (cell)
> jordanz@shop.com
>
> SHOP*COMTM
> Shop Smart, Save Big(tm)
> www.shop.com
>
> This message (including any attachments) is intended only for
> the use of the individual or entity to which it is addressed and
> may contain information that is non-public, proprietary,
> privileged, confidential, and exempt from disclosure under
> applicable law or may constitute as attorney work product.
> If you are not the intended recipient, you are hereby notified
> that any use, dissemination, distribution, or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, notify us immediately by telephone and
> (i) destroy this message if a facsimile or (ii) delete this
> message
> immediately if this is an electronic communication.
>
> Thank you.
>
RE: requestSendMessage()
Posted by Jordan Zimmerman <jo...@shop.com>.
>What you're doing looks correct to me. Are you getting any errors when
you
>invoke the callback? What browser are you using?
No, no errors. Also, I've debugged into the callback and I can see that
the message is being posted. I'm using FF 3.0.10.
Am I correct that I need to register to the callback in the gadget ala:
gadgets.rpc.register(gadgets.rpc.CALLBACK_NAME, _my_handler);
Jordan Zimmerman
Principal Software Architect
831.647.4712
831.214.2990 (cell)
jordanz@shop.com
SHOP*COMTM
Shop Smart, Save Big(tm)
www.shop.com
This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this
message
immediately if this is an electronic communication.
Thank you.
Re: requestSendMessage()
Posted by Kevin Brown <et...@google.com>.
On Mon, May 11, 2009 at 4:46 PM, Jordan Zimmerman <jo...@shop.com> wrote:
> >Both gadget to container and container to gadget communications are
> >possible in an async channel, but you don't really need that. The
> >parent page can (and should) respond asynchronously to RPC calls:
>
> I can't get this to work. In my container I have:
>
> gadgets.rpc.register
> (
> "requestSendMessage",
> function(recipients, message, opt_callback, opt_params)
> {
> // do some stuff
> var functionResult = ...
> if ( this.callback )
> {
> this.callback(functionResult);
> }
> }
> );
>
> RPC relay is registered in both container and gadget. I tried various
> things in the gadget including calling:
>
> gadgets.rpc.register(gadgets.rpc.CALLBACK_NAME, _my_handler);
>
> What do I need to do in the gadget to get the callback to resolve?
What you're doing looks correct to me. Are you getting any errors when you
invoke the callback? What browser are you using?
>
>
> Jordan Zimmerman
> Principal Software Architect
> 831.647.4712
> 831.214.2990 (cell)
> jordanz@shop.com
>
> SHOP*COMTM
> Shop Smart, Save Big(tm)
> www.shop.com
>
> This message (including any attachments) is intended only for
> the use of the individual or entity to which it is addressed and
> may contain information that is non-public, proprietary,
> privileged, confidential, and exempt from disclosure under
> applicable law or may constitute as attorney work product.
> If you are not the intended recipient, you are hereby notified
> that any use, dissemination, distribution, or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, notify us immediately by telephone and
> (i) destroy this message if a facsimile or (ii) delete this
> message
> immediately if this is an electronic communication.
>
> Thank you.
>
RE: requestSendMessage()
Posted by Jordan Zimmerman <jo...@shop.com>.
>Both gadget to container and container to gadget communications are
>possible in an async channel, but you don't really need that. The
>parent page can (and should) respond asynchronously to RPC calls:
I can't get this to work. In my container I have:
gadgets.rpc.register
(
"requestSendMessage",
function(recipients, message, opt_callback, opt_params)
{
// do some stuff
var functionResult = ...
if ( this.callback )
{
this.callback(functionResult);
}
}
);
RPC relay is registered in both container and gadget. I tried various
things in the gadget including calling:
gadgets.rpc.register(gadgets.rpc.CALLBACK_NAME, _my_handler);
What do I need to do in the gadget to get the callback to resolve?
Jordan Zimmerman
Principal Software Architect
831.647.4712
831.214.2990 (cell)
jordanz@shop.com
SHOP*COMTM
Shop Smart, Save Big(tm)
www.shop.com
This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this
message
immediately if this is an electronic communication.
Thank you.
Re: requestSendMessage()
Posted by Kevin Brown <et...@google.com>.
On Thu, May 7, 2009 at 2:13 PM, Jordan Zimmerman <jo...@shop.com> wrote:
> >https://issues.apache.org/jira/browse/SHINDIG-1049
>
> I've run into a problem with this and would like some suggestions. The
> callback argument throws a wrench into things. The RPC mechanism doesn't
> allow support of the callback. I can see three possible solutions:
>
> * Return NOT_IMPLEMENTED if a callback is passed
>
> * Discover a way to do reverse RPC (is this possible)?
Both gadget to container and container to gadget communications are possible
in an async channel, but you don't really need that. The parent page can
(and should) respond asynchronously to RPC calls:
opensocial.requestSendMessage = function(..iforgettheargnames..., callback)
{
gadgets.rpc.call("..", "requestSendMessage", callback,
otherargumentsgohere);
}
container page:
gadgets.rpc.register("requestSendMessage", function(message) {
showSomeUiComponentToConfirmMessageWithCallback(message, this.callback);
});
The container page must call rpc.callback to send the reply message back,
but this certainly works. See the 'process' function in gadgets.rpc for
details.
> * Don't use RPC for requestSendMessage(). Instead add a method to
> AppDataService such as:
> Future<Void> sendMessage(Set<UserId> userIds, String appId,
> Set<String> fields, SecurityToken token)
> throws ProtocolException;
>
> Thoughts?
>
> Jordan Zimmerman
> Principal Software Architect
> 831.647.4712
> 831.214.2990 (cell)
> jordanz@shop.com
>
> SHOP*COMTM
> Shop Smart, Save Big(tm)
> www.shop.com
>
> This message (including any attachments) is intended only for
> the use of the individual or entity to which it is addressed and
> may contain information that is non-public, proprietary,
> privileged, confidential, and exempt from disclosure under
> applicable law or may constitute as attorney work product.
> If you are not the intended recipient, you are hereby notified
> that any use, dissemination, distribution, or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, notify us immediately by telephone and
> (i) destroy this message if a facsimile or (ii) delete this
> message
> immediately if this is an electronic communication.
>
> Thank you.
>
RE: requestSendMessage()
Posted by Jordan Zimmerman <jo...@shop.com>.
* bump *
Jordan Zimmerman
Principal Software Architect
831.647.4712
831.214.2990 (cell)
jordanz@shop.com
SHOP*COMTM
Shop Smart, Save Big(tm)
www.shop.com
-----Original Message-----
From: Jordan Zimmerman [mailto:jordanz@shop.com]
Sent: Thursday, May 07, 2009 2:14 PM
To: shindig-dev@incubator.apache.org
Subject: RE: requestSendMessage()
>https://issues.apache.org/jira/browse/SHINDIG-1049
I've run into a problem with this and would like some suggestions. The
callback argument throws a wrench into things. The RPC mechanism doesn't
allow support of the callback. I can see three possible solutions:
* Return NOT_IMPLEMENTED if a callback is passed
* Discover a way to do reverse RPC (is this possible)?
* Don't use RPC for requestSendMessage(). Instead add a method to
AppDataService such as:
Future<Void> sendMessage(Set<UserId> userIds, String appId,
Set<String> fields, SecurityToken token)
throws ProtocolException;
Thoughts?
This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this
message
immediately if this is an electronic communication.
Thank you.
RE: requestSendMessage()
Posted by Jordan Zimmerman <jo...@shop.com>.
>https://issues.apache.org/jira/browse/SHINDIG-1049
I've run into a problem with this and would like some suggestions. The
callback argument throws a wrench into things. The RPC mechanism doesn't
allow support of the callback. I can see three possible solutions:
* Return NOT_IMPLEMENTED if a callback is passed
* Discover a way to do reverse RPC (is this possible)?
* Don't use RPC for requestSendMessage(). Instead add a method to
AppDataService such as:
Future<Void> sendMessage(Set<UserId> userIds, String appId,
Set<String> fields, SecurityToken token)
throws ProtocolException;
Thoughts?
Jordan Zimmerman
Principal Software Architect
831.647.4712
831.214.2990 (cell)
jordanz@shop.com
SHOP*COMTM
Shop Smart, Save Big(tm)
www.shop.com
This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this
message
immediately if this is an electronic communication.
Thank you.