Posts

Showing posts with the label software engineering

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 using NextJS Parallel and Intercepting Routes

Image
Introduction In the previous article I guided some ways to use NextJS App Router, now we will continue with 2 other features including Parallel Routes: as the name implies you can understand that it allows to define many separate routes and put them together on 1 route for display, the very clear advantage is that it helps to separate UI, isolate errors (if any), easy to maintain and expand functionality Note that if you use this feature and in the main route has define an additional 1 page that is not a Parallel Routes, then in the Parallel Routes should have an additional file to show default information to avoid 404 errors when accessing directly (we will go into more detail in the detail part below) Intercepting Route: Allows "blocking" a route to display that content in another context (for example: a link will display a Modal, but when reloading that page, a separate page will open). Prerequisites This article is continued to be developed from previous articles, please ...