Socket
Socket
Sign inDemoInstall

pull-handshake

Package Overview
Dependencies
4
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pull-handshake

easily create a duplex protocol that starts with a handshake


Version published
Weekly downloads
219
decreased by-20.65%
Maintainers
1
Install size
45.4 kB
Created
Weekly downloads
 

Readme

Source

pull-handshake

Create handshakes for binary protocols with pull streams.

Example

var stream = handshake()
var shake = stream.handshake

// Pull some amount of data out of the stream
shake.read(32, function (err, data) {

  // Write a response...
  shake.write(new Buffer('hello there'))

  shake.read(32, function (err, data) {
    // Get a confirmation,
    // and then attach the application
    var stream = createApplicationStream()

    pull(stream, shake.rest(), stream)
    // shake.rest() returns a duplex binary stream.
  })
})


// shake is itself a duplex pull-stream.
pull(shake, stream, shake)

API

handshake([opts], [callback])

opts

Type: Object
Default: {timeout: 5e3}

The allowed duration for the handshake to take place.

callback

Type: Function
Default: function noop () {}

This will be called when the handshake completes, or fails. In the case of failure it is called with an error.

License

MIT

FAQs

Last updated on 05 Aug 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc