Showing posts with label tutorial. Show all posts
Showing posts with label tutorial. Show all posts

Tuesday, July 30, 2013

Real Time Communication with Socket.io

Socket.io lets us enable real-time communication between web browsers. In this basic tutorial I'll show you how to build a simple "game" that lets you pass a puck back and forth between clients in real time.

The basic steps will be:
  1. Install Node.js.
  2. Install Socket.IO.
  3. Create a directory for your project containing the backend code (title it app.js) and a file for the frontend (title it index.html).
  4. From the command line and inside the project directory start the server by typing: node app.js 
  5. Open a browser and point it at: http://localhost:4000.
  6. Open a second browser and point it at the same URL.
  7. Click the puck and watch socket.io work its magic!
Let's get started!