Provider File on same host as client producing error during RPC

144 views
Skip to first unread message

Adam St. John

unread,
Sep 8, 2013, 6:47:52 PM9/8/13
to eas...@googlegroups.com
All,

We have a third party widget that is working really well for us in a RPC setup with a remote provider file. This works fine in a normal situation where our client library is loaded into a different host.

e.g.

http://www.client.com loads javascript library with RPC provider located at http://www.production.com/provider.html.

However, when we tried to embed our own library on the same domain as the provider (for documentation and example reasons), the provider side of the system crashes.

e.g.

http://www.production.com loads javascript library with RPC provider located at http://www.production.com/provider.html.

In this scenario, the javascript on the provider side crashes out with the following error:

Uncaught Error: Could not find easyXDM in parent

I'm currently at a loss as to why this error is produced only when the client and the provider are on the same domain. 
This error is produced during no conflict setup and when not in a no conflict setup.

Has anyone else encountered this issue? Any help is much appreciated.

Thanks,
Adam

Øyvind Sean Kinsey

unread,
Sep 8, 2013, 6:54:10 PM9/8/13
to easyxdm

This is due to the SameOriginTransport not playing well with the noConflict feature unless both pages call it the same way.

--
You received this message because you are subscribed to the Google Groups "easyxdm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to easyxdm+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Adam St. John

unread,
Sep 9, 2013, 11:16:12 AM9/9/13
to eas...@googlegroups.com
Thanks for the quick response and such an awesome library. I'm not sure I completely follow. Both the production.com and client.com pages load and call easyXDM in the same manner.

Here is our setup in more detail:

We have a single file which loads our main dependencies for us into a third party webpage using YepNope. One of our dependencies is our main widget source file which has easyXDM bundled into it. Within the main source, we initialize as:

Domain.XDM = easyXDM.noConflict('Domain.XDM');

and then to setup easyXDM, we have:

    this.socket = new Domain.XDM.Rpc(
      {
      },
      {
        local: {},
        remote: {
          fetch_some_json_objs: {}
        },
        serializer: Domain.JSON
      }
    );

In our provider.html file, we simply load another single javascript file which sets up easyXDM as follows:

Domain.XDM = easyXDM.noConflict('Domain.XDM');

and within our source on the provider javascript we have something like:

    this.socket = new Domain.XDM.Rpc({},
      {
        local: {
          fetch_some_json_objs: this._do_some_stuff
        },
        remote: {
          respond_to_stuff: {}
        },
        serializer: Domain.JSON
      }
    );

Loading easyXDM on the provider fails here, but only when we load our widget on our own domain. The only thing we're actually doing to make things break is load the client on the same domain as the provider file. We're doing this purely as an example on some documentation pages. When using our set-up as intended (3rd party widget on another domain), everything is fine.

Thanks for your help,

Adam

Adam St. John

unread,
Sep 16, 2013, 3:40:18 PM9/16/13
to eas...@googlegroups.com
If anyone else out there has any ideas, I'd appreciate some feedback.

Thanks,
Adam

Shelagh Lewins

unread,
May 11, 2015, 2:17:39 PM5/11/15
to eas...@googlegroups.com
I have the same problem. Did you ever find a solution?

Adam St. John

unread,
May 11, 2015, 2:18:44 PM5/11/15
to eas...@googlegroups.com
Unfortunately, no. We had to work around it.
You received this message because you are subscribed to a topic in the Google Groups "easyxdm" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/easyxdm/cuU8swAo8uo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to easyxdm+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages