Building Real-Time Messaging System

Unveil how we developed a custom messaging system that helped the client enhance their customers' experience on their application.

  • Cloud Development
  • EdTech
  • UK
Building Real-Time Messaging System

Executive Summary

Developing a Scalable Real-Time Messaging System

Our Customer

LearnCube is an online education platform that enables anyone, anywhere to access world-class teachers. It is designed as a virtual classroom with live chat and other real-time collaborations like a whiteboard.

The platform is trusted by top language schools, tutoring companies & corporate trainers like Oxford University Press, Lingoda, and many others.

The Obstacles They Faced

The main obstacle LearnCube faced was scaling out their services rapidly to deal with a peak in demand as a result of Covid-19. At the same time optimizing costs was another challenge they needed to overcome.

How We Helped

Even though we had implemented several small projects for LearnCube, the main project was a real-time messaging system using AWS API Gateway with WebSockets, Lambda, and ElastiCache services, which the customer needed for synchronizing whiteboards and classroom data between students and teachers.

Romexsoft recommended Amazon’s API Gateway as a fully managed service that handles APIs at any scale. It also supports two-way WebSocket messaging and events handling, which was important for LearnCube to trigger a call-back function based on the message/event type.

The Challenges

Cost Optimization

Having experienced significant growth due to the COVID-caused shift to online education, the company faced the need to optimize costs and enhance customers’ experience. A significant share of expenses was paid to the commercial third-party solutions, including a real-time messaging and collaboration solution based on WebSocket.

The Solution

Messaging Solution App for Education Industry

LearnCube chose AWS as their cloud platform to become more agile, innovative, and efficient. Based on a variety of AWS tools, Romexsoft helped the customer achieve high scalability, reliability, latency, cost and security optimization.

The client’s main infrastructure is running in AWS Cloud. Having positive experience in collaboration with Romexsoft before, LearnCube asked us to come up with a solution that had to meet two major goals: less expenses compared to the existing solution and high reliability. To resolve this issue our company suggested implementing a real-time messaging system based on API Gateway with WebSockets, Lambda, and ElastiCache services.

Amazon API Gateway is a fully managed service that handles APIs at any scale. Also, it supports two-way WebSocket APIs. Such events like WebSocket connect and disconnect are provided out of the box. So, the solution works in the following way:

  • WebSocket connection is initiated from the client-side via Vue.js and passed through API Gateway to the written in Node.js AWS Lambda function that stores connection information like connectionId, userId, and classRoomId in the AWS ElastiCache. API Gateway securely keeps the WebSocket connection in its pool.
  • The client sends a message through the opened WebSocket connection to API Gateway’s onMessage endpoint. Another AWS Lambda handler gets classRoomId from the payload, gets all stored in ElastiCache connections with this classRoomId, and performs broadcast of message body using AWS.ApiGatewayManagementApi SDK.
  • When the client exits the classroom or class is finished the disconnect event is sent to API Gatewaydisconnect endpoint. AWS Lambda handler gets message info and removes it from ElastiCache. API Gateway removes the connection from its pool.

Custom AWS Lambda authorizer is used to initiate WebSocket connections from authenticated users only. AWS ElastiCache has primary and read replicas in different availability zones to support high availability and performance. Also, ElastiCache is located in the VPC in a private subnet. So Lambda handlers are also placed in the VPC and NAT Gateway is set up to provide an external communication for AWS.ApiGatewayManagementApi SDK to broadcast messages. All Lambdas and API Gateway metrics are recorded in AWS CloudWatch logs.

Real-Time Messaging System AWS Architecture Diagram

AWS Architecture Diagram: Real-Time Messaging System for E-learning SaaS

Amazon Web Services utilized

AWS Lambda icon
Lambda
Amazon ElastiCache icon
ElastiCache
Amazon Virtual Private Cloud icon
Virtual rivate Cloud (VPC)
Amazon API Gateway icon
API Gateway
Amazon CloudWatch icon
CloudWatch
AWS Identity and Access Management icon
Identity and Access Management (IAM)

Verified by AWS

This case study is validated by AWS. Experts and professional auditors from AWS reviewed this case study and verified that we, Romexsoft, have built a functional infrastructure and efficient cloud solution.

It showcases the value that Romexsoft, being a certified AWS Advanced Tier Services Partner, delivers cloud solutions according to AWS standards and best practices.

Check out Romexsoft’s profile at AWS Partner Network.

The Results

Cost Reduction and Enhanced Reliability

  • Decreased monthly costs for the real-time messaging solution almost 3x times which was a sizable monetary value.
  • High reliability and guarantee of messages delivery to the end client.
  • Solution transparency and observability via CloudWatch logs and dashboards.

Why Romexsoft

Partner With Us to Build a Messaging System

Romexsoft is an AWS-certified Consulting Partner, trusted Software Development Company and Managed Service Provider, founded in 2004. We help customer-centric companies build, run, and optimize their cloud systems on AWS with creative, stable, and cost-efficient solutions.

Our key values

  • Delivery of quality solutions
  • Customer satisfaction
  • Long-term partnership

We have successfully delivered 100+ projects and have a proven track record in FinTech, HealthCare, AdTech, and Media industries.

Romexsoft possesses a 5-star rating on Clutch due to its strong expertise, responsiveness, and commitment. 60% of our clients have been working with us for over 4 years.

Related Success Stories

Building a Decoupled Architecture for EdTech SaaS
Discover how we decoupled the application architecture, facilitating further scalability, elasticity, and cost-efficiency of the system.
  • Application Modernization
  • EdTech
  • UK
SaaS Infrastructure Monitoring and 24×7 DevOps Support
Сomprehensive infrastructure monitoring and 24x7 DevOps support to enhance the performance, resilience, and scalability of the application.
  • 24/7 DevOps Support
  • EdTech
  • UK

Craft Your Vision – Make the First Step.
Book a Consultation With Our Experts.

    Contact Romexsoft
    Get in touch with AWS certified experts!