New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More →
Socket
Sign inDemoInstall
Socket

@brigade/pooled-thrift-client

Package Overview
Dependencies
Maintainers
5
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brigade/pooled-thrift-client

A Thrift client utilising a pool of service connections and improved error handling/recovery

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by700%
Maintainers
5
Weekly downloads
 
Created
Source

pooled-thrift-client

npm version Build Status

A node Thrift client utilising a pool of service connections and improved error handling/recovery

Features

  • proper Promise support in pool instance con/destruction
  • correct behaviour on "Internal Error", aka, socket misalignment on unhandled server errors
  • better/existent timeout support for: connections, pool checkout, execution
  • builtin retry support using upstream Thrift code
  • faster detection and pruning of dead connections
  • async/await and other niceties

Example usage

Given a thrift file calculator_service.thrift with contents:

service CalculatorService {
  void ping(),
  i32 add(1:i32 num1, 2:i32 num2)
}

Compile with the thrift command (installable via your package manager):

thrift --gen js:node calculator_service.thrift

This will produce JS definitions for your service, which can then be used to create a client:

import CalculatorService from './CalculatorService';
import thriftClient, { AcquisitionTimeoutError, ConnectionTimeoutError } from 'pooled-thrift-client';

// host and port are mandatory see other config options in comments
const host = '127.0.0.1', port = 9000;
const client = thriftClient(CalculatorService, { max: 5 }, { host, port });

// use the client as you would a regular client, get pooling for free
client.add(1, 2).then(sum => console.log(sum));

Keywords

FAQs

Package last updated on 24 Jan 2018

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