Description
We have a kind of exotic use case where we want to instantiate a websocket off an existing stream that's not from an HTTP or unix socket source. Currently the createConnection method is hardcoded to either create a TLS or standard net connection:
|
opts.createConnection = isSecure ? tlsConnect : netConnect; |
I suggest allowing a custom createConnection function to be passed in the websocket options and, if present, it should take precedence over the existing default logic.
I'm happy to put together a PR for this if it's something you'd accept 🙂
ws version
8.2.2
Node.js Version
v16.6.1
System
System:
OS: Windows 10 10.0.19043
CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
Memory: 23.22 GB / 63.89 GB
Expected result
N/A
Actual result
N/A
Attachments
No response
Description
We have a kind of exotic use case where we want to instantiate a websocket off an existing stream that's not from an HTTP or unix socket source. Currently the
createConnectionmethod is hardcoded to either create a TLS or standard net connection:ws/lib/websocket.js
Line 654 in f871195
I suggest allowing a custom
createConnectionfunction to be passed in the websocket options and, if present, it should take precedence over the existing default logic.I'm happy to put together a PR for this if it's something you'd accept 🙂
ws version
8.2.2
Node.js Version
v16.6.1
System
System:
OS: Windows 10 10.0.19043
CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
Memory: 23.22 GB / 63.89 GB
Expected result
N/A
Actual result
N/A
Attachments
No response