So far, we've only scratched the surface of our backend application. We are going to add a service layer to our server. This abstraction layer will implement all the business logic, such as instant messaging. The service layer will handle interaction with other application modules and layers.
As for the WebSockets
part of the application, we are going to use socketIO
, which is a real-time communication engine. They have a really neat chat application example. If you haven't heard of it, you can take a look at the following link:
http://socket.io/get-started/chat/
Now that we are familiar with socketIO
, we can continue and implement our chat service. We are going to start by creating a new file called app/services/chat/index.js
. This will be the main file for our chat service. Add the following code:
'use strict'; const socketIO = require('socket.io'); const InstantMessagingModule = require('./instant-messaging.module'); module.exports = build...