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.
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><%= title %></title> <base href="/"> </head> <body> <mean-app> <h1>Loading...</h1> </mean-app> <script type="text/javascript"> window.user = <%- user...