Cannot access Piwik server from node.js client

Here is my code

var https =require(‘https’);
function piwikRecordClientPageViews(req,res,next)
{

            var PiwikClient = require('piwik-client');
            var myClient = new PiwikClient('https://localhost:6443/piwik/piwik.php', 'token_auth_here' );

            myClient.api({
              method:   'Actions.getPageUrls',
              idSite:   1,
              period:   'day',
              date:     'today'
            }, function (err, responseObject){
                //Code etc etc
                    if(err)
                    console.log('error is '+err);
                    else
                    {
                    console.log(responseObject);
                    res.send('done');
                    }
            });

}

When I run this , the request times out and I do not get any response …
But I get my error message message ‘error is Unexpected token C’ twice in the node.js console
Both the node.js application and the piwik server are on a ubuntu machine that I ssh into and I am having self signed SSL certificate for the ubuntu machine. So, essentially both applications using self signed certificate (they are on same ubuntu machine)
I had tried using the raw apis yesterday and in them the SSL handshake fails. So, thought of trying the node.js client.

And fyi, the https://url/to/piwik/piwik.php returns me a mostly blank page with Piwik is a free open source web analytics that lets you keep control of your data. written. So, through browser it does work and piwik is set up well.
Can anyone help with this?