Building Real-Time Messaging System for E-learning Company

DevOps Development Services | Customer Case Study | EdTech

Verified by AWS

Romexsoft AWS Advanced Tier Services Partner Badge

Executive Summary

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 Challenge

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

Amazon Web Services

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.

Solution Delivered by Romexsoft

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
AWS Architecture Diagram: Reliable and Cost-effective Real-Time Messaging System for E-learning SaaS.

Amazon Web Services utilized

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

What We Achieved Together

  • 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.


LearnCube Logo

The system introduced by Romexsoft was significantly cheaper than the client’s previous third-party alternative. The product was reliable. The team was responsive, easy to work with, and facilitated direct calls for the project’s progress.The team is very knowledgeable and quick to acquire answers if further research is required.

Daniel O’Reilly, CTO at LearnCube

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 Consulting Partner, delivers cloud solutions according to AWS standards and best practices.

Check out Romexsoft’s profile at AWS Partner Network.

Romexsoft AWS Advanced Tier Services Partner Badge

Why Romexsoft

Being a trusted Software Development vendor and Managed Service provider since 2004, Romexsoft has managed to successfully deliver more than 100 customized solutions to their clients.

  • Romexsoft has expansive skillset in AWS which is proven by the official AWS Consulting Partner certification and a huge number of satisfied customers.
  • 60% of our clients have been working with us for over 4 years maximizing their ROI through long-term partnership relationships.
  • 90% of clients are willing to refer the company due to the rapid start, transparent pricing, and strong expertise in the development of software solutions for the HealthCare, FinTech, AdTech, EdTech, and Media industries.

Let’s Talk about Your Business Needs!