Reader small image

You're reading from  Socket.IO Cookbook

Product typeBook
Published inOct 2015
Reading LevelIntermediate
PublisherPackt
ISBN-139781785880865
Edition1st Edition
Languages
Right arrow
Author (1)
Tyson Cadenhead
Tyson Cadenhead
author image
Tyson Cadenhead

Tyson Cadenhead works as a senior JavaScript engineer at Aloompa in Nashville, Tennessee. He has dedicated his professional career to building large-scale applications in JavaScript and Node. Tyson addresses audiences at various conferences and programming meetups on how to build real-time web applications with Socket.IO or Meteor.js. He blogs on topics such as JavaScript and web technologies at http://www.tysoncadenhead.com. Tyson lives in the greater Nashville area with his wife and two sons, where he enjoys gardening, raising chickens, reading philosophy and economics books, and playing guitar.
Read more about Tyson Cadenhead

Right arrow

Creating a simple chat room


A basic chat room application is one of the most widely used demos. This shows off Socket.IO or even web sockets in a more general sense. The reason for this is that it immediately gives the business case for Socket.IO in a way that is easy to follow and digest.

Building a basic chat room with Socket.IO is neither terribly difficult or complex. This is the sort of application that Socket.IO was designed for.

When we have completed our chat application, it will look something similar to the following screenshot:

Getting ready

For this recipe, we will use jQuery for simple DOM manipulation and Bootstrap for styling purposes. None of these libraries are required to create a chat app with Socket.IO, but they all provide useful utilities that we can easily tap into.

How to do it…

To create a simple chat application with Socket.IO, follow these steps:

  1. Create a server.js file. This file will start your server and emit Socket.IO events whenever a new message is posted to the...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Socket.IO Cookbook
Published in: Oct 2015Publisher: PacktISBN-13: 9781785880865

Author (1)

author image
Tyson Cadenhead

Tyson Cadenhead works as a senior JavaScript engineer at Aloompa in Nashville, Tennessee. He has dedicated his professional career to building large-scale applications in JavaScript and Node. Tyson addresses audiences at various conferences and programming meetups on how to build real-time web applications with Socket.IO or Meteor.js. He blogs on topics such as JavaScript and web technologies at http://www.tysoncadenhead.com. Tyson lives in the greater Nashville area with his wife and two sons, where he enjoys gardening, raising chickens, reading philosophy and economics books, and playing guitar.
Read more about Tyson Cadenhead