“AYO” Chat service using Micro-services Architecture

Ineskd
Mint IT
Published in
3 min readJul 1, 2020

On having a chat service we often end-up with a complex implementation, and the latest trends, when it comes to building a Mobile Application or a Website we always need service to support real-time chat.

Our objectif:

build your own messager service in less time using the Ayo chat API that could be easily integrated within the applications.

Technology Stack

  • NodeJS (v11.6.0): an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
  • Socket.io (v2.3.0): Socket.IO enables real-time, bidirectional and event-based communication. It works on every platform, browser or a device, focusing equally on reliability and speed.
  • Redis (v4.0): in-memory data structure store, used as a database, cache and message broker.

Architecture:

Components in the Architecture:

  • Clients: Any clients supporting Socket.io clients.
  • Each chat service installed on the instance is completely independent of the other instances.
  • Load Balancer: It is a single point where all the clients get connected with the sticky session. All messages and Other request pass through a load balances that smothly distributed message to your app server.They make sure that any request is processed with lowest possible time frame.they can be scaled up and down quickly to meet any request
  • MongoDB Atlas/ Casandra: Any relational database can be used to persist chat related data.
  • Redis: used for the in-memory cache and message broker service. Message broker service is used to transfer data between two or more Chat services.

Integration

So this how we can integrate the “AYO chat” service in a microservice architecture

API Gateway:The API gateway handles requests in one of two ways. Some requests are simply proxied/routed to the appropriate service. It handles other requests by fanning out to multiple services.

Third part service: is the an other service that interacts with chat service.

gRPC: is a modern open source high performance RPC that can efficiently connect services in and across data centers with pluggable support for load balancing.

Message Broker: like RbbitMQ Each Service handles and collaborates with other services in order to perform on a given request coming from the Client via inter-communication among them.

Use cases :

Primary use cases occur for categories including on-demand (O2O), E-commerce (conversational commerce), customer service, video streaming, media (content distribution), business collaboration, eSports, banking (fintech), healthcare amongst others.

Wrapping up

Through this solution, we were able to create a simple, scalable and customizable chat micro-service application. The service was able to support features like one-to-one chat, group chat, etc. Also, the architecture enables different applications to work on a single deployed service, having low cost in terms of computation and resources.

--

--