resolve-alpn
Detects the ALPN protocol
Last updated 7 years ago by szmarczak .
MIT · Repository · Bugs · Original npm
$ cnpm install resolve-alpn 
SYNC missed versions from official npm registry.

resolve-alpn

Build Status Coverage Status

API

resolveALPN(options)

Returns an object with an alpnProtocol property. The socket property may be also present.

const result = await resolveALPN({
	host: 'nghttp2.org',
	ALPNProtocols: ['h2', 'http/1.1']
});

console.log(result); // {alpnProtocol: 'h2'}

options

Same as TLS options.

options.resolveSocket

By default, the socket gets destroyed and the promise resolves.
If you set this to true, it will return the socket in a socket property.

const result = await resolveALPN({
	host: 'nghttp2.org',
	ALPNProtocols: ['h2', 'http/1.1'],
	resolveSocket: true
});

console.log(result); // {alpnProtocol: 'h2', socket: tls.TLSSocket}

// Remember to close the socket!
result.socket.end();

License

MIT

Current Tags

  • 1.2.1                                ...           latest (4 years ago)

3 Versions

  • 1.2.1                                ...           4 years ago
  • 1.1.2                                ...           4 years ago
  • 1.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (5)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org