This repository has been archived by the owner on Aug 21, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make JavaScript HttpConnection emit timeout event (#3)
The JavaScript `HttpConnection` allows the caller to set a request timeout via the `nodeOptions` property. However, neither the HTTP connection nor the thrift client provides a way for the caller to know when a timeout occured. With this change, the `HttpConnection` will now emit a timeout event when the NodeJS timeout event occurs. A caller can add an event listener to the connection as follows: ``` const thrift = require('thrift'); const connection = thrift.createHttpConnection('localhost', 1234, { nodeOptions: { timeout: 1000 } }); connection.on(); connection.on('timeout', () => { console.log('Request timed out after 1000ms'); }); ```
- Loading branch information