Using HTML5 Channel Messaging with Web Intents to create persistent relations

Hi,

I wanted to text creating a message channel between a Client page and a Service page when running in Chrome and using the JS shim from webintents.org but I didn't get it working. I a probably doing something stupid...

The code in the Client page is:

         var channel = new MessageChannel();

          var intent = new Intent();
          intent.action = "http://webintents.org/view";
          intent.type = "video/*";
          intent.data = channel.port2;

          window.navigator.startActivity(intent, function (intentData) {
              alert (intentData);
          });

         channel.port1.onmessage = function (evt) {
                alert (evt.data);
          };

The Service page code is:

     If (!!window.intent) {

          var port = intent.data;

          if (port) {
             port.start();
             port.postMessage("Port received");
          }, false);

      }

However, Chrome does not recognize port as a Message port object. What's wrong. Sorry for not being very experienced with JavaScript.

Claes

[cid:image001.gif@01CCF189.09B1C2C0]

Claes Nilsson M.Sc.E.E
Master Engineer, Research
Technology Research - Advanced Application Lab

Sony Ericsson Mobile Communications
 Phone:  +46 10 80 15178
Mobile: +46 705 56 68 78
Switchboard: +46 10 80 00000
E-Mail: mailto:claes1.nilsson@sonyericsson.com
Visiting Address; Nya Vattentornet
SE-221 88 LUND,
Sweden
Disclaimer:
The information in this e-mail is confidential and may be legally privileged. It is intended solely for the named recipient(s) and access to this e-mail by anyone else is unauthorized. The views are those of the sender and not necessarily the views of Sony Ericsson and Sony Ericsson accepts no responsibility or liability whatsoever or howsoever arising in connection with this e-mail.Any attachment(s) to this message has been checked for viruses, but please rely on your own virus checker and procedures. If you contact us by e-mail, we will store your name and address to facilitate communications. If you are not the intended recipient, please inform the sender by replying this transmission and delete the e-mail and any copies of it without disclosing it.

Received on Wednesday, 22 February 2012 17:14:52 UTC