plain-tcp

0.0.1 • Public • Published

plain-tcp

Build Status

A very simple tcp server and client build with frp-middleware

Check out the full API over at the frp-middleware repo.

Installation

$ npm install plain-tcp --save

Usage

import assert             from 'assert'
import { Server, Client } from 'plain-tcp'
 
let server = new Server(5442)
server
.map(data => { 
  assert(data === 'hello')
  return 'world'
})
.subscribe()
 
let client = new Client(5442) 
client.emit('hello', data => {  
  assert(data === 'world') 
}) 

API

#emit(String)

Sends a message to the Server. Without handling the response.

#emit(String, function)

Sends a message to the Server and calls the provided function with the response.

#subscribe()

Starts listening on the port. If a map returns an empty value the server doesn't respond to the client.

Package Sidebar

Install

npm i plain-tcp

Weekly Downloads

2

Version

0.0.1

License

GPL-3.0

Last publish

Collaborators

  • doodzik