mattes / inwx-nodejs Goto Github PK
View Code? Open in Web Editor NEWInternetWorX XML-RPC API Client for NodeJS
Home Page: https://www.inwx.de
License: MIT License
InternetWorX XML-RPC API Client for NodeJS
Home Page: https://www.inwx.de
License: MIT License
I tried your codesample, but the API is ready message never comes:
inwx({api: "production", user: "myusername", password: "mypassword"}, function(api){
console.log("API is ready");
Trying with testing api produces the error (but OK, I don't even have an testing API account and don't known how to make one, so..):
4|inwx | Error
4|inwx | at ClientRequest.<anonymous>
(/home/myusername/nodejs_apps/node_modules/inwx/lib/inwx.js:62:15)
4|inwx | at emitOne (events.js:77:13)
4|inwx | at ClientRequest.emit (events.js:169:7)
4|inwx | at Socket.socketErrorListener (_http_client.js:258:9)
4|inwx | at emitOne (events.js:77:13)
4|inwx | at Socket.emit (events.js:169:7)
4|inwx | at emitErrorNT (net.js:1256:8)
4|inwx | at nextTickCallbackWith2Args (node.js:441:9)
4|inwx | at process._tickDomainCallback (node.js:396:17)
PM2 | App [inwx] with id [4] and pid [12695], exited with code [1] via signal [SIGINT]
Trying with production API, I looked into the node_modules/inwx/lib/inwx.js
file and tried out some console.log messages to get an idea of where the problem is.
function inwx(opts, readyCallback) {
...
this.client = xmlrpc.createClient({ host: opts.host, isSecure: true, path: "/xmlrpc/", cookies: true });
console.log("inwx.js: so far 1"); // is called successfully
this.call("account", "login", {user: opts.user, pass: opts.password}, function(response) {
console.log("inwx.js: connected!"); // never called!!!
this.connected = true;
readyCallback.call(this, that);
});
return that;
}
inwx.prototype.call = function call(object, method, params, successCallback, errorCallback) {
if(!object) throw new Error("missing object for xmlrpc call");
if(!method) throw new Error("missing method for xmlrpc call");
console.log("inwx.js: so far 2"); // is called successfully
this.client.methodCall(object + "." + method, [ params ], function(error, response){
console.log("inwx.js: so far 3"); // never called!!!
if(error) {
So apparently the callback function of this.client.methodCall
is never called.
Tested on fresh Ubuntu 16.04 LTS server (nodejs v4.2.6) and fresh Ubuntu 17.10 desktop (nodejs v6.11.4). freshly installed NodeJS via:
cd ~ && mkdir nodejs_apps && cd nodejs_apps
sudo apt-get install nodejs npm build-essential
sudo ln -s "$(which nodejs)" /usr/bin/node
sudo npm install express
sudo npm install body-parser
sudo npm install request
sudo npm install pm2 -g
sudo npm install inwx
working with pm2 to run the app
Full example app is here: https://pastebin.com/bhdREpNf
When installed via npm the last pull request (or more?) is not included. Therefore, the library is then broken.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.