View on GitHub

reading-notes

Readings: Socket.io

Reading

Web Sockets

What is a Web Socket?

Describe the Web Socket request/response handshake and what happens once the connection is established.

Web Sockets provide a standardized way for the server to send content to a client without first receiving a ____ from that client.


Socket.io Tutorial

What does the event handler io.on() do?

Describe some possible proof of life or proof that the code works as expected

const app = require('express')();
const http = require('http').Server(app);

app.get('/', function (req, res) {
  res.sendFile('E:/test/index.html');
});
//Whenever someone connects this gets executed
io.on('connection', function (socket) {
  console.log('A user connected');
  //Whenever someone disconnects this piece of code executed
  socket.on('disconnect', function () {
    console.log('A user disconnected');
  });
});

http.listen(3000, function () {
  console.log('listening on *:3000');
});

What does socket.emit() do?


Socket.io vs Web Sockets

What is the difference between WebSocket and Socket.IO? (think Git and GitHub, or OAuth and Auth0).

When would you use Socket.IO?

When would you use WebSockets?

Videos

OSI Model Explained

What are a couple of key takeaways from this video?


TCP Handshakes Explained

Translate the gist of this video to a non-technical friend

Reflection

What are your learning goals after reading and reviewing the class README?

My goal is to be comfortable with web sockets, and have a firm grasp on the basic syntax, and how to implement the tool in my applications.