Add `createConnection` option for http or https requests
Hi,
I need a possibility of using createConnection option in the http/https request:
createConnection <Function> A function that produces a socket/stream to use for the request when the agent option is not used. This can be used to avoid creating a custom Agent class just to override the default createConnection function. See agent.createConnection() for more details. Any Duplex stream is a valid return value.
You can read more info about this function in the Node.js documentation: https://nodejs.org/api/http.html#http_http_request_options_callback
NOTE: The createConnection of globalAgent isn't suitable for me because I use other connections
P.S. Thanks for your work and the best library for EventSource.
Is this functionality in the spec? If not, why do you think we should deviate from the spec?
Of course this option isn't in EventSource specification. This option (createConnection) is only for Node.js® as other your options (in your code): proxy, rejectUnauthorized ...
I suppose we could add it as a non-standard property on the eventSourceInitDict object. Any objections from anyone?
@xv2 send a pull request and we can discuss it.
@aslakhellesoy PR: https://github.com/EventSource/eventsource/pull/120
This would be extremely helpful as there doesn't currently seem to be a way to use UNIX domain sockets with this library.
Can we get a ruling on this?