We can send information to our servers when we submit user info or words but how do we get the server to update us without requesting updates manually? We use Socket.IO to enable real-time two-way event-based communication. Documentation for Socket.IO is available at
socket.io/docs. We install it by executing the following code:
npm install --save socket.io
First, we require
socket.io and our game in
var socketIO = require('socket.io'); var Game = require('./app/controllers/game');
Authorization takes place during handshaking, which is when the socket connection is established. Without handshaking, we would not know which socket connection belongs to which Express session. As given in the following ...