Giter Club home page Giter Club logo

Comments (7)

cascornelissen avatar cascornelissen commented on May 27, 2024

If I quickly run multiple requests (api.registerUser, +5 times) I'm running into the same issue as described in this StackOverflow question and the Uncaught TypeError: self.req.abort is not a function error shows up too. Any chance node-hue-api is not consuming the data as explained in the answer?

from node-hue-api.

cascornelissen avatar cascornelissen commented on May 27, 2024

I switched to nw.js and I'm running into the exact same problem...

CC @peter-murray

from node-hue-api.

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

Why are you trying to register a user so many times?

I have not had a chance to look into the register user code, but it does look like that the connections are not being closed out. I will put together a set of tests for this to check if this is actually an issue on my side. Where is the error actually coming from, do you have a point in the code? It looks like it may be coming from within the request library, not mine.

As for upping the limit, you can set that directly yourself, and the http.globalAgent.maxSocket is a global.

from node-hue-api.

cascornelissen avatar cascornelissen commented on May 27, 2024

I'm executing registerUser at an interval since I was having trouble reaching my hub within 30 seconds. I'm not trying to register a user multiple times a second, I'm just retrying after a set amount of seconds (5 seconds currently)/

What you're saying is probably correct though, the amount of requests exceeds a certain number (which is somehow set it while using it through Electron/NW, because it seems to work correctly in a browser). I stated the point in the code in my original post: node_modules/request/request.js:1340.

I'll try and play with the max socket limit.

from node-hue-api.

cascornelissen avatar cascornelissen commented on May 27, 2024

@peter-murray, I've been trying and testing a lot and I came up with the following script (which gets combined with node-hue-api via browserify) that throws the Uncaught TypeError: self.req.abort is not a function error when run through Electron/NW.js but successfully logs the resulting configuration object when run in a browser.

var hue = require('node-hue-api'),
    api = new hue.HueApi('192.168.x.x', 'xxx');

api.config().then(function(result) {
    console.log(result);
}).done();

from node-hue-api.

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

I have just created a 2.0.0-RC1 release of the library that now uses a different http request library, axios.

Can you try to use that and see if that clears up the problems you are experiencing? Also can you confirm if you are still converting this library using browserify?

Thanks

from node-hue-api.

cascornelissen avatar cascornelissen commented on May 27, 2024

@peter-murray, you are an absolute hero! I updated to 2.0.0-RC1 and that finally resolved the problems I was having.

Probably unrelated now but yes I am still using your library in combination with browserify.

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.