(EDIT by @Trott: Turns out this is a documentation bug. Labeling good-first-contribution and doc.)
"use strict";
const NetSocket = require("net").Socket;
const TlsSocket = require("tls").TLSSocket;
const tlsSocket = new TlsSocket(new NetSocket());
tlsSocket.once("connect", function doStartup () {
console.log("The tls socket connected. Yay!");
});
tlsSocket.connect({port: 6697, host: "irc.freenode.net"});
console.log("Sent connect.");
The program ends immediately after the connect is called, telling me that the connection isn't started.
Note that if we don't wrap the net.Socket in a TLSSocket, then the connect works as expected.
(EDIT by @Trott: Turns out this is a documentation bug. Labeling
good-first-contributionanddoc.)The program ends immediately after the connect is called, telling me that the connection isn't started.
Note that if we don't wrap the
net.Socketin aTLSSocket, then the connect works as expected.