Install Dependencies and Types
Video Lecture
Description
Create Socket Server Script, Install Dependencies and Types
./src/server/server.ts
Note
In the video, my server.ts
is using Socket.IO 2.3.0
, the code below has now been updated to support Socket.IO 4.5.1
which means that line 14 has now been updated from
const io = socketIO(this.server)
to
const io = new socketIO.Server(this.server);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
Install Dependencies and Types
Install Types for NodeJS
npm install @types/node@16 --save-dev
Install SocketIO
npm install socket.io@4
Note
In the video I've installed the types @types/socket.io
. This is no longer necessary since they now come included with the installation of socket.io
instead.