This PR adds a bind behavior on the tunnel builders' listen() which returns a tunnel object that includes a pre-bound TCP socket which is returned in a handle property, which satisfies the NodeJS HTTP server's listen().
The module-level listen() quick start one-liner that takes an http (including express) server argument is still the best option, as this will attempt to use unix sockets or windows named pipes. The http server has to listen to files first before the tunnel is wired up, which is why unix/pipes can only be done for the user if we have a reference to the http server:
This PR adds a bind behavior on the tunnel builders'
listen()
which returns a tunnel object that includes a pre-bound TCP socket which is returned in ahandle
property, which satisfies the NodeJS HTTP server'slisten()
.The behavior can be turned off with
listen(false)
on the builders:This PR also replaces
getSocket()
withlistenable()
that uses the samehandle
behavior, for a quick start like:Or as a one-liner:
The module-level
listen()
quick start one-liner that takes an http (including express) server argument is still the best option, as this will attempt to use unix sockets or windows named pipes. The http server has to listen to files first before the tunnel is wired up, which is why unix/pipes can only be done for the user if we have a reference to the http server: