Okay, it’s been long enough: we want a real server process, not a fake one running in the browser. To get there, we have to fight through a mess of confounding issues: how to get both the in-browser client and server-side process to restart, and how to get them to talk using WebSockets. Along the way, we run into not one but several false starts using off-the-shelf libraries.
Notes/highlights
- “The Case of the Missing Hit”, a all-time great podcast from Reply-All, about a song someone swears they remember but doesn’t actually seem to exist: https://gimletmedia.com/shows/reply-all/o2h8bx
- “Ethereum is a Dark Forest”: an article written by Jeff and Dom’s former colleague, Dan Robinson, about how you can’t just pick free cryptocurrency off the ground, because there are bots that will beat you to it as soon as you reach for it. https://medium.com/@danrobinson/ethereum-is-a-dark-forest-ecc5f0505dff
- Koa, a modern NodeJS webserver: https://koajs.com/
- The BSD 3-Clause license, which is what we chose for our project, to stop the tools from complaining about a missing license. https://en.wikipedia.org/wiki/BSD_licenses#3-clause_license_(%22BSD_License_2.0%22,_%22Revised_BSD_License%22,_%22New_BSD_License%22,_or_%22Modified_BSD_License%22)
- ngrok, a nice service for exposing a webserver on your computer to the public internet: https://ngrok.com/
- We recommend not using fancy stuff for watching files. fs.watch is a built-in file watching function for NodeJS that will do 90% of what you need: https://nodejs.org/api/fs.html#fs_fs_watch_filename_options_listener
- We recommend not using fancy stuff for connecting your webserver to WebSockets. Instead, just copy/paste this code: https://github.com/jeffanddom/manchester/blob/537e7a2d838d2ed65c2db46d680e3d2695a653bd/gameService/serve.ts#L39-L51