(Self-answer moved from the question into the answers section)
simply use
ngrok http 3000
You will see the web address string that localhost binds to. So in the client javascript code, change
var socket = io.connect('http://localhost:3000');
to
var socket = io.connect('http://94349fe6.ngrok.io');
NOTE:
http://94349fe6.ngrok.io
is just that web address string. Yours will be different from this one.
Actually, if one simply does:
var socket = io();
as the introduction to socket.io states:
it defaults to trying to connect to the host that serves the page
So it works as well.