Complete the code to import the Socket.io library.
const express = require('express'); const http = require('http'); const socketIo = require('[1]');
The correct package to import for Socket.io server is socket.io.
Complete the code to create an HTTP server from the Express app.
const app = express();
const server = http.createServer([1]);The HTTP server is created from the Express app instance, so app is passed.
Fix the error in initializing Socket.io with the HTTP server.
const io = socketIo([1]);Socket.io needs the HTTP server instance to bind to, so server is correct.
Fill both blanks to listen for a new client connection and log a message.
io.on('[1]', (socket) => { console.log('A client [2]'); });
The event to listen for new clients is 'connection' (A). The log message is A client connected, so {{BLANK_2}} is connected (C).
Fill all three blanks to emit a message to the client when connected.
io.on('connection', ([1]) => { [2].[3]('welcome', 'Hello from server!'); });
The callback parameter is usually named socket. To send a message, call socket.emit. So the first and third blanks are 'socket', the second blank is 'emit'.