tcp-factory
v1.0.0
Published
TCP factory
Downloads
9
Readme
Factory for TCP server/client. This is smart wrapper for net module which can help You to build server/client Node.js applications working with custom protocols based on TCP/IP
npm i -s tcp-factory
Provide an options object to the constructor:
const TCP_FACTORY = require('tcp-factory');
const TCP = new TCP_FACTORY({
port: 8888,
host: '127.0.0.1',
handlers: {
onClose: () => {
},
onData: function (data) {
},
onError: (e) => {
},
onConnect: function() {
}
}
});
TCP.Server - this property is a TCP server which is configured and run with provided options TCP.Client - this property is a tcp client which is configured and with provided options. You should initialize connection with TCP.Client.connect() method running.