Aller au contenu principal

How does Remote Control work

Commentaires

11 commentaires

  • Cam Barnard

    Hi Berend - we are still working on the SDK and documentation side of this, but I'm sure we can dig up an example for you to work from.

    0
  • Berend Veldkamp

    Thanks, that would be awesome.

    0
  • Permanently deleted user

    Hi Berend. I've attached a zip containing the sample that shows basic usage of our post message bridge API.

     

    Some important notes:

    0
  • Berend Veldkamp

    Hi Ian,

     

    Thanks for this sample, it looks helpful.

     

    If I understand things correctly, viewer.postmessage sends a message to the parent window, is that right? Is it also possible to send a message to an IFrame contained inside the Web Viewer?

     

    And how do I setup the viewer to receive messages? app.json is not included in the zip file, so that part is not clear to me yet. If for instance I want to send a message to run a workflow, how can I include workflow in the viewer?

     

    Berend

     

    0
  • Cam Barnard

    Hi Berend,

     

    There are two patterns we envision for integrating GXW and other applications.

     

    The first pattern is GXW as child. This means that another application invokes GXW and holds the keys to communication.

    This is the case for the example we sent you, embedding GXW in a web page.

    This would also be the pattern for integrating GXW with an external 3rd party application where that application opens and maintains the connection to GXW.

    With this pattern:

    • Communication from the other app to GXW happens via postMessage that GXW is listening for (you’ll find that in the html of the example)
    • Communication from GXW to the other app happens via a postMessage command (you’ll find that wrapped in a workflow that Ian provided a link to). The app.json you asked about is also available via a link Ian provided.

     

    The second pattern is GXW as parent. This means that GXW invokes the other application and holds the keys to communication.

    This is the case for the example you asked about such as embedding a 3rd party application inside GXW.

    We do not yet have a good example for this pattern, one will be coming with your GXW SDK.

    What we intend is to always do this case by writing custom component.

    The SDK example will demonstrate:

    • The custom component contains an iframe
    • The custom component initializes the 3rd party app inside its iframe and keeps the keys to communication
    • The custom component has full access to the GXW commands/operations
    • The custom component speaks to the 3rd party app inside its iframe using postMessage commands that deliver payloads understood by that 3rd party application
    • The custom component also initializes postMessage listeners capable of receiving postMessage commands and payloads sent by that 3rd party application

    The code inside the listener can then perform native GXW work in the listener code.

    0
  • Berend Veldkamp

    Hi Cam,

     

    Thanks for the detailed answer. I can't wait for the SDK to come out, maybe something for the Christmas holidays? 😉

    0
  • Berend Veldkamp

    One more thing: I changed the message to call a workflow. The workflow is called, but I get an error in the browser's console:

     

    Workflow inputs are not accepted from untrusted sources, to allow inputs enable acceptsUrlParams for the workflow with ID: 057a841a-bd35-4d43-b7b3-06f5a5330498

     

    Where do I have to specify acceptUrlParams, and what value should it have?

    0
  • Permanently deleted user

    Ah, yes. If you're launching a Workflow through the postMessage bridge, we only allow the execution of that Workflow if the Workflow configuration item has been configured in the app configuration with the acceptsUrlParams set to true (for security reasons). If you're editing the application configuration JSON for that app, you would change your workflow configuration item to look something like:

     

    {

    "id": "057a841a-bd35-4d43-b7b3-06f5a5330498",

    "portalItem": "https://www.arcgis.com/sharing/rest/content/items/id-of-your-workflow-item",

    "acceptsUrlParams": true,

    "$type": "workflow"

    }

     

    This same configuration is what also allows you to execute workflows via a URL parameter when launching the viewer, and has similar security concerns.

     

    After making that change and running it through the postMessage bridge it should work as expected!

    0
  • Berend Veldkamp

    Yes now it works, thanks.

     

    BTW, it doesn't exactly work as you describe: The workflow does run, even without acceptUrlParams, it's just that no parameters were passed to the workflow. So if this is really meant to prevent workflows from running, something would be wrong.

    0
  • Permanently deleted user

    I'll pass that along to the team to double check the intended behavior. Thanks Berend!

    0
  • Cam Barnard

    Someone mentioned the older example attached to this thread wasn't working ... here is a more up to date example: https://vertigis-web-samples.netlify.app/iframe

    0

Vous devez vous connecter pour laisser un commentaire.