webdriverio-automation
Version:
WebdriverIO-Automation android ios project
45 lines (29 loc) • 1.14 kB
Markdown
[](https://travis-ci.org/szmarczak/resolve-alpn) [](https://coveralls.io/github/szmarczak/resolve-alpn?branch=master)
Returns an object with an `alpnProtocol` property. The `socket` property may be also present.
```js
const result = await resolveALPN({
host: 'nghttp2.org',
ALPNProtocols: ['h2', 'http/1.1']
});
console.log(result); // {alpnProtocol: 'h2'}
```
Same as [TLS options](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback).
By default, the socket gets destroyed and the promise resolves.<br>
If you set this to true, it will return the socket in a `socket` property.
```js
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();
```
MIT