This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26505 - // first set phone into peering mode
Summary: // first set phone into peering mode
Status: RESOLVED DUPLICATE of bug 26512
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-03 08:13 UTC by contributor
Modified: 2014-08-04 17:45 UTC (History)
2 users (show)

See Also:


Attachments

Description contributor 2014-08-03 08:13:33 UTC
Specification: http://www.w3.org/TR/webmessaging/
Multipage: http://www.whatwg.org/C#top
Complete: http://www.whatwg.org/c#top
Referrer: 

Comment:
  // first set phone into peering mode
   // nfcService is the NFC service, discovered through the webinos Discovery
API, that has been selected by the user   
   nfcService.peer(success, fail);
 
 function success (channel)
 {
   console.log("successfully initiated peering mode");
 
   // to send a message to the other device
   channel.port1.postMessage('hello');
 
   // to receive a message from the other device
   // first you set a message handler
   channel.port1.onmessage = handleMessage;
 
   // you next instruct the channel to dispatch events
   // you can later close the port with the stop() method
   // your device then reverts to its normal mode
   channel.port1.start();
 }
 
 function handleMessage(event)
 {
   // message is in event.data
   // ...
 }
 
 // after a time out when peering couldn't be established
 function fail ()
 {
   console.log("failed to initiate peering mode");
 }


Posted from: 61.228.227.139
User agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36
Comment 1 Ian 'Hixie' Hickson 2014-08-04 17:45:17 UTC

*** This bug has been marked as a duplicate of bug 26512 ***