create-local-domain-socket
A helper function to create cross-platform local domain sockets (UNIX domain sockets on UNIX, and named pipes polyfill on Windows).
Usage
createLocalDomainSocket
;; /* create a whatever you want server */const server = http; ;
If you prefer using promise:
const server = http; ;
Arguments
server
<Object>: A server object. Should include a.listen()
and.on('error')
methods to start and catch errorspath
<String>: Local domain pathcallback
<Function> (Optional): A callback function. The first argument is anError
object if listen failed. Ifcallback
isundefined
, it will return a promise
ensureLocalDomainPath
A tiny helper function to ensure local domain path. On Windows, it will convert to named pipe path instead of local domain path.
Example on Windows
; const path = ;console; /* "\\\\.\\pipe\\test" */
Installation
npm install --save create-local-domain-socket
ws
Example to integrate with;;; const server = http; ;
License
MIT