tcp-factory

1.0.0 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i tcp-factory

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

4.95 kB

Total Files

10

Last publish

Collaborators

  • pashaman