Giter Club home page Giter Club logo

Comments (3)

peter-murray avatar peter-murray commented on May 27, 2024

I am respecting the location header being returned. The search data being returned to me from my bridge has a value of http://192.168.2.150:80/description.xml for the LOCATION value.

The point of the code that you indicate as hard coded is a direct link to the description.xml file, but is not used in the lookup from the SSDP lookups.

I had looked at your library in the past, but I wanted this library to be a small as possible, and your SSDP library includes a lot of extra dependencies that I did not want to pull in for an edge case bridge lookup that over 95% of users of the library would not need. When Hue released an update to finding of the bridges, they now have a broker service, which is the preferred discovery method.

from node-hue-api.

achingbrain avatar achingbrain commented on May 27, 2024

I'm not sure that it is respecting the location header. Take a look at this gist.

If you run server.js, it'll open two http servers - one on port 80, one on 8080 and set up a dgram socket to respond to bridge search requests.

The dgram socket responds with LOCATION: http://localhost:8080/foo.xml in the message, so if node-hue-api respects the location header, it should make a request to port 8080 and request /foo.xml.

search.js contains the upnp example search code from the node-hue-api readme. When I run it I see:

$ sudo node server.js
Socket listening
Responding to bridge search request
Responded to bridge search request
Got request for /description.xml on port 80
$ node search.js
Hue Bridges Found: [{"id":"WRONG PORT!","ipaddress":"localhost"}]

So it's requesting http://localhost:80/description.xml even though the LOCATION header in the search response is http://localhost:8080/foo.xml.

from node-hue-api.

peter-murray avatar peter-murray commented on May 27, 2024

Thanks for that, the penny finally dropped. I had checked that the LOCATION was being returned in the SSDP results, but of course you were right, as after that I defaulted to pulling the discovery xml via an API call, thereby not actually following the URL.

I have switched the code to issue a simplified HTTP GET on the LOCATION that is returned, which has no change on my bridge, as it is returning the http://192.168.2.150:80/description.xml value for me.

This has been released in version 1.1.1 of the library.

from node-hue-api.

Related Issues (20)

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.