Socket.IO and TypeScript
- 3.5 hours on-demand video
- 1 downloadable resource
- Full lifetime access
- Access on mobile and TV
- Certificate of Completion
Get your team access to 4,000+ top Udemy courses anytime, anywhere.Try Udemy for Business
- TypeScript Annotations, Types, Interfaces, Classes
- TSC and tsconfig for browsers and NodeJS environments
- Setup NodeMon and Concurrently
- NPM, NodeJS and package json
- Understand SocketIO communications between the Server and Clients while writing it all in TypeScript
- Build an example multiplayer, realtime mini game along with a chat component that allows players to guess the lucky numbner and win/lose points accordingly
- You'll get exposure to Bootstrap, jQuery, HTML and CSS animations
- Learn about Express and serving static content through NodeJS
- Learn how to build robust and interactive applications using TypeScript and SocketIO
- Provision and Deploy to a cloud server, Setup Nginx proxy, Point a Domain Name and Add SSL
- Desire to code games and interactive content
- Access to a PC, Mac or Linux with ability to install software such as VSCode, Git and NodeJS
In this course you will learn about how to use Socket.IO in order to create multiplayer real-time interactive content that runs in the browser and on the web. We will also write it using TypeScript.
At the start of the course, there is a TypeScript crash course, suitable for those with no experience at all of using TypeScript. It will cover the most common and major concepts of TypeScript that are applicable to all TypeScript projects and will be used throughout the remainder of this course.
Then, we will move onto learning about Socket.IO, and covering the major features that are also applicable to all Socket.IO projects, and will also be demonstrated throughout the remainder of this course.
Then we will apply all of the Socket.IO concepts we've learned so far, to create our selves a complete working multiplayer, real-time game example with several game configurations running concurrently, with client and server components and hosted using NodeJS.
We will also deploy the finished project to a cloud server, run it behind an Nginx proxy, point a domain name and install an SSL certificate.
When creating the main course project you will also get exposure to Bootstrap, jQuery, HTML and CSS animations.
You don't need any experience to take this course, since all the code is provided in the accompanying documentation that will be presented to you in a gradual format as each lesson progresses to the next.
Before taking this course, note that executing code snippets, copied from the supplied documentation is a major part of this course. The examples provided in the course were 100% created by me and were explicitly created for use in this course. You are invited to experiment with each new code addition after each lesson, by changing parameters and deleting or extending sections, in order to understand more about what each new addition of the project is doing.
So if you know that you like coding, you like seeing it work for yourself, you like to experiment, and have millions of ideas that you want to achieve, then this course is for you. Because at the end of the course, you would have built a generic working prototype that demonstrates many of the concepts involved in creating multiplayer real-time interactive content that runs in the browser and on the web.
Thanks for taking part in my course, and I will see you there.
- Beginner Coders
- People interested in SocketIO and TypeScript
- People interested in creating real-time interactive multiplayer games
To create a development environment like mine, install these packages.
VSCode : https://code.visualstudio.com/
Git for Windows : https://gitforwindows.org/
NodeJS : https://nodejs.org/en/download/
We will create our first typescript file and name it foo.js
We can run this file directly in Nodejs or include it in a web page, and it will run inside the browser. But it isn't typescript.
$ node foo.js
Rename the foo.js to foo.ts
We can then compile it
$ tsc foo.ts
$ node foo.js
Manually recompiling and restarting the NodeJS server upon each change to the code can become tedious. So we look at the option of automating the recompilation and server restarting using tsc watch option, nodemon and concurrently.
We will now build a sample Mini Games server and client below using all of the things we've covered so far.
We will now deploy our game to a production server on the internet.
Create the Start Script in the package.json
Provision a Cloud Server for Production
Deploy Files to the Server
Start the Games on the server
Set up an Nginx Proxy
Set up and Point a Domain Name
Install an SSL certificate
At the end, our Socket.IO Mini Games, developed using TypeScript, will be officially on the internet for the public to see.
When running on production, we don't need to use nodemon, concurrently or have TSC watching our source code for any changes we make to the files.
We can create a more simplified starting script that will just start the main server.js in NodeJS.
I want a publicly accessible server on the internet so that I can share my game with my friends.
I will use a Linux server with the Ubuntu 18.04 LTS operating system and It will be setup using Digital Ocean (FREE $50 - 30 Day Credit) as the cloud provider.
We could get an internet connected server from many different cloud providers, such as GCP, Azure, AWS, Hetzner, and many many more.
On Digital Ocean, I will use choose the $5 a month Standard Ubuntu 18.04 64 bit LTS.
If you register using my link https://m.do.co/c/23d277be9014, you will get $50 worth of Credit for 30 days, and often the deal can be even better. So be sure to check just in case.
Navigate into the folder that contains the package.json
$ cd /var/www/minigames
Now, install the packages from the package.json by using the command,
$ npm install
Now, you can start the Mini Games server.
$ npm start
Now open a browser and visit http://[your ip address]:3000
I also want to point a domain name and an SSL certificate to the games server. We can add settings inside our server.js which is being run by NodeJS to manage this, but it is very common to use a proxy instead for this purpose. We can use Nginx. Nginx will be able to manage proxying for all your domain names and SSL certificates for this server if you had several websites running on it.
I have a domain already, and I can add subdomains to it, so I will create a new subdomain, minigames.your-domain.tld
In my domain name provider, I will create a new A name record called minigames for my main domain your-domain.tld that points to the IP address of the new server.
Give it some time to propagate, and then visit