1 Reply Latest reply on Jan 16, 2009 9:25 AM by PeteApps

    LocalConnection from AIR to AIR

    PeteApps
      Hi, all!

      I am working on a pair of test apps in AIR using the LocalConnection class. This is driving me crazy! My LocalConnection.Send executes without any error, but the StatusEvent always comes back with

      [StatusEvent type="status" bubbles=false cancelable=false eventPhase=2 code=null level="error"]

      This does not give me much to go on. I tried to "step into" the .send method, but the debugger just goes into the next statement.

      I have double checked the application id, domain name, etc. and also tried putting allowdomain="*" and allowinsecuredomain="*" with no luck.

      The receiving app issues the connect command fine, and I display the domain name back to the app so I can verify it. When I issue the send command, the test app displays the connection name, which matches the receiver's connect.

      Thanks for helping!

      Pete
        • 1. LocalConnection from AIR to AIR
          PeteApps Level 1
          Ok, I have found the issue.

          It seems that this event is thrown if the Send connection name does not match the name of an application that is currently accepting messages. In other words, the connection name used in Connect command on the receiver does not match, or the receiving application is not running.

          What was confusing to me was the way to get at the correct connection name for the Send command.

          On the receiver's Connect command, I used this: "_InterCommAppTestB".

          It gets combined with "app#" then the domain name, in my case com.applebysw.test then the application name, "InterCommAppTestB", followed by "." then the publisher id, then ":" and then the connection name used in the Connect command, "_InterCommAppTestB".

          The receiver's local connect .domain property gives you most of that, you just need to append the ":" and then the connection name.

          In my case, the domain is:

          app#com.applebysw.test.InterAppCommB.<publisher id hex digits>

          The connection name on the Send must then be:

          app#com.applebysw.test.InterAppCommB.<publisher id hex digits>._InterAppCommTestB


          Note that this will not work in the Flex debugger, since the publisher id is an empty string until the AIR app is signed and published. Perhaps it would work if you ran both the sending and receiving apps in the debugger at the same time, I don't have any more time for experiments with this.

          I was not able to make the connection work unless I used the "_" prefix on the connection name.

          On the receiver, I also had to use either

          .allowDomain("*")

          or

          .allowDomain("app#com.applebysw.test.InterAppCommA.<publisher id hex digits>")

          Note that the above is the domain name of the sending app.

          This was confusing to me, but it worked.

          I hope that this saves someone else some time, it was a long day yesterday...

          Pete