michaelwittig / node-q

Q interfacing with Node.js
MIT License
52 stars 14 forks source link

Added ability to contact KDB with Unix Domain Sockets rather than TCP #49

Closed na21 closed 4 years ago

na21 commented 4 years ago

Unix Domain Sockets allow for better performance than TCP and is preferable if node-q is being utilized on the same machine as the KDB/Q server. Changes don't work with KDB 3.5+ on Linux as it utilizes the abstract namespace for Unix Domain Sockets and the "net" module doesn't support connecting to those sockets (there is a module called "abstract-socket" that adds this support). This will work on older versions of KDB and on MacOS.

Connecting by TCP still works the same as before. Below code is for connecting by Unix Domain Sockets, also supports authentication with username and password.

nodeq.connect({ unixSocket: "/path/to/socket" }, function(err, con) {
    if (err) throw err;
    console.log("connected");
});
michaelwittig commented 4 years ago

Thanks @na21

I released version 2.5.0 with your changes!