<et cetera>
I always wondered how discord launches its desktop application when you click on an invite link from the browser. I’m no full-stack / front-end developer, and my knowledge is very limited when it comes to anything of this sort, so this was a bit of messing around.
For example, I tried joining The Programmer’s Hangout, a public discord server about programming. Upon clicking the invite url in my browser (Firefox), discord.gg/programming, I’m immediately taken to the already-launched discord application with the invite link already open.
This ramble stemmed from when I installed Port Authority, a Firefox extension that blocks websites from scanning all your computer/network ports. Many moons after installing Port Authority, I opened a discord invite url. I saw a notification that said “This site attempted to port scan you!” followed by “Port Authority has blocked this site from bypassing security measures and port scanning your private network”.
Naturally I was worried, but opened up the good-ol’ network tab in DevTools to see what was going on. Turns out: WebSockets. This is how discord “beams” information to your desktop application, using ports 6463 to 6472 on your localhost. It goes sequentially through the ports when they fail and Port Authority blocks all of them.
But what do these WebSocket requests contain? Data about the server and information that the desktop application needs:
That’s pretty much it lol.
</et cetera>
Post Script: the webMinimal.*.js JavaScript file that discord transfers (roughly 3.6MB) contains VERY interesting things. Download it, install js-beautifier, prettify the file, and ctrl+f for “easter” or “egg”. There’s a lot of fascinating things you can find like:
// this object is approximately 17,849 lines long
e.exports = Object.freeze({
...
POLLS_MARKETING_EASTER_EGG_PIZZA_EMOJI_DESCRIPTION: "{emojiName} (without pineapple)",
POLLS_MARKETING_EASTER_EGG_LOADING_LINE: "Statistically speaking, the majority of Discord users believe that pineapple and pizza is the most cursed food combo. Thank our Polls feature launch for this Discord Fact™.",
...
})
which, I’m not really sorry to say, is just plain wrong. 🍍 + 🍕 = 👌.