Posts

Showing posts with the label low latency

Connecting NextJS with NestJS via SocketIO

Image
Introduction SocketIO is a powerful library that enables bidirectional, real-time, event-based communication between the server and the browser. The key advantages include: Low Latency: Instant data transmission instead of having to send continuous requests. Reliability: Automatic reconnection on connection loss and fallback support to HTTP long-polling if WebSocket is unavailable. Broadcasting: Easily send data to one or multiple clients simultaneously. In this article, I will guide you on using NextJS and NestJS to communicate with each other via SocketIO, simulating a chatbot app and the AI Agent's workflow. Detail On NestJS project you need to install these packages: yarn add @nestjs/websockets @nestjs/platform-socket.io socket.io Create the controller/conversations.controller.ts file returning the conversation list as follows: import { Controller, Get } from "@nestjs/common" ; @ Controller ( "conversations" ) export class ConversationsController {...

Guide to Initializing and Connecting AWS DynamoDB

Image
Introduction Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability at any scale. Key benefits include: unlimited scalability, extremely low latency in milliseconds, built-in security, and flexible pricing models based on usage (On-demand) to optimize costs. Detail Use AWS CDK to create the lib/dynamodb-stack.ts file import * as cdk from "aws-cdk-lib" import * as dynamodb from "aws-cdk-lib/awsf-dynamodb" import { Construct } from "constructs" export class DynamodbStack extends cdk . Stack { constructor ( scope : Construct , id : string , props ?: cdk . StackProps ) { super (scope, id, props) const productTable = new dynamodb. Table ( this , "ProductTable" , { tableName: "Products" , partitionKey: { name: "id" , type: dynamodb.AttributeType. STRING , }, billingMode: dynamodb.Bi...