Creating the Chat Angular module

In order to finish our chat implementation, we're going to create a new Angular chat module. Our module will include our component and template, a routing configuration, and a service wrapping the socket.io client functionality. Socket.io provides us with a client library to handle the socket communication; however, a best practice would be to obfuscate it using our own Angular service. We'll begin by configuring the Socket.io client library.

Setting up the Socket.io client library

To set up the Socket.io client library, we'll need to include the library JavaScript file in our index.ejs template. To do that, go to the app/views/index.ejs file and make the following change:

<!DOCTYPE html> <html> <head> <title><%= ...

Get MEAN Web Development - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.