Fully integrates terminal with game and layout. allows game.html to interact with app.js through main.js's socket.