I found the answer for anyone who gets immensely confused by the horrible lack of documentation of socket.io. You cannot source /socket-lib/socket.io.js, you must source http://yourwebsite.com:12345/socket.io/socket.io.js. The server automatically does the rest for you.
There may be security restrictions that prevent your browser from downloading the D3 script. What you can do is to download the scripts, place them in the same folder as your files, and change the referenced paths in your source.
How come this code throws an Uncaught ReferenceError: $ is not defined when it was OK before? Results in tabs don’t close anymore. jQuery is referenced in the header: