Giter Site home page Giter Site logo

chrome-upnp's People

Contributors

kensakukomatsu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chrome-upnp's Issues

control over SOAP

after implementing whitelist-xhr, trying to control over SOAP will be necessary.

Opera's sample code is helpful.
http://people.opera.com/richt/release/specs/discovery/Overview.html

 function successCallback( services ) {

  // Listen for service push messages

    services[0].addEventListener('message', function ( msg ) {
         debug.innerHTML += "<br>" + services[0].name + " event received: ";
         debug.textContent += msg.data;
    }, false);

 // Send a control signal to mute the service audio

    var svcXhr = new XMLHttpRequest();
    svcXhr.open("POST", services[0].url); // services[0].url and its
                                          // subresources have been whitelisted for
                                          // cross-site XHR use in this current
                                          // browsing context.

    svcXhr.setRequestHeader('SOAPAction', 'urn:schemas-upnp-org:service:RenderingControl:1#SetMute');
    svcXhr.setRequestHeader('Content-Type', 'text/xml; charset="utf-8";');

    svcXhr.onreadystatechange = function ( response ) {
      if( response.readyState != 4 || response.status != 200 )
        return;
      debug.innerHTML += "<br>" + services[0].name + " response received: ";
      debug.textContent += response.responseXML;
    }

    // Service messaging to mute the provided service
    var svcMsg = '<?xml version="1.0" encoding="utf-8"?>' +
                 '<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" ' +
                   'xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">' +
                   '<s:Body>' +
                     '<u:SetMute xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1">' +
                       '<InstanceID>0</InstanceID>' +
                       '<Channel>Master</Channel>' +
                       '<DesiredMute>true</DesiredMute>' +
                     '</u:SetMute>' +
                   '</s:Body>' +
                 '</s:Envelope>';

    svcXhr.send(svcMsg);
    debug.innerHTML += "<br>" + services[0].name + " request sent: ";
    debug.textContent += svcMsg;
  }

  function errorCallback( error ) {
    debug.innerHTML += "<br>An error occurred: " + error.code;
  }

white-list xhr

To obtain description.xml and do control with SOAP, shim has to support white-list xhr.

In the web apps level, indicating "http://*/" in permissions property is enough. So interface from shim to content_script page have to be implemented.

try web app (chrome.socket)

In the WebIntents-TF ML, Paul mentioned that chrome.socket works only Chrome Apps.

"Just a quick note, it is not intended for the raw sockets API to be available to extensions. Only the new form Chrome Apps, so this might explain why it is not working for you."

So, trying UPnP shim on web apps

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.