Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

primus-tcp

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

primus-tcp

Primus Raw TCP Transformer (Server-to-Server)

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

Primus-Tcp

Primus Raw TCP Transformer. Connect Node.js to Vanilla TCP Servers via Primus.

Getting Started

Install the transformer with this command:

npm install primus-tcp --save

Add the transformer to the Primus constructor and subscribe to the events.

var primus = require('primus');
var transformer = require('primus-tcp/transformer/tcp');
var parser = require('primus-tcp/parser/pipe');

var PrimusSocket = primus.createSocket({
    transformer: transformer,
    parser: parser
});

var url = "...";    //Destination Server
var options = { };  //Standard Primus Options

var connection = new PrimusSocket(url, options);

//Standard Primus Events
connection.on("open", function(){ /*...*/ });
connection.on("end", function(){ /*...*/ });
connection.on("reconnect", function(){ /*...*/ });
connection.on("error", function(){ /*...*/ });
connection.on("data", function(data){ /*...*/ });

Now we are able to connect to a vanilla tcp server (Java?) and still keep all the neat abstractions (reconnect, heartbeat, etc) that Primus provides.

Keywords

FAQs

Package last updated on 14 May 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc