Meteor soap client not reusing sockets on https


#1

I am using the meteor zardak soap client to connect to a soap server. i am calling 2 methods on the server one after the other. On http, using keep-alive-agent node module i was able to retrieve results using a single socket connection. But when on HTTPS, the keep-alive-agent is not working and a default agent gets assigned while looking at the log. Any help appreciated. I also tried the normal https agent but not working

my client code:

import { Meteor } from 'meteor/meteor';
import KeepAliveAgent from 'keep-alive-agent';
import https from 'https';


Meteor.startup(() => {
  // code to run on server at startup


//var url = 'http://localhost/wsdl?wsdl';
var url = 'C:/meteorapps/soapclient/server/HelloService.wsdl';
var args = {firstName: 'Betty'};

myAgent = new KeepAliveAgent.Secure( { maxSockets:1 } );

//myAgent = new https.Agent();

var options = {
  agent: myAgent,
  headers: {"Connection":"Keep-Alive"},
  maxSockets:1,
  keepAlive:true,
  keepAliveMsecs:3000,
}

try {
   
  var client = Soap.createClient(url,options);

  client.setSecurity(new Soap.ClientSSLSecurity(
    'C:\\SSLkeyandcert\\server.key',
    'C:\\SSLkeyandcert\\server.crt',
    {

      strictSSL:false,
      
    }, 
    
  ));
  
  client.addSoapHeader({Username:'Johnson'});

  var result = client.sayHello(args,options);
  console.log(result);
  result = client.sayHelloHi({firstNameHi:'John'},options);
  console.log(result);
}

catch (err)  {
  if(err.error === 'soap-creation') {
    console.log('SOAP Client creation failed');
  }
  else if (err.error === 'soap-method') {
    console.log(err);
  }

}

});