API with NestJS #26. Real-time chat with WebSockets - In this article we look into what are WebSockets and implemenet a simple real-time chat functionality.
With WebSockets, we can perform a two-way communication in real-time between the user and the server. Thanks to that, the browser can send messages to the server and listen to information from the other side.
WebSocket is a protocol that operates in a different way than HTTP. Even though that’s the case, establishing the connection begins with the client sending an HTTP call that we call a handshake.
The server listens for incoming socket connections using a regular TCP socket. The client sends a GET request to the URL of our socket.
Request URL : ws ://localhost:8080/
Request Method : GET
####### Request headers:
Headers : Connection : Upgrade
Upgrade : websocket
Sec - WebSocket - Key : 2GruKa / C487njkWNw2HKxQ ==
Building Modern Nodejs Application using Nestjs and TypeScript - In this article, we will see how to build REST API using Nestjs with TypeScript. Building Modern Nodejs Application using Nestjs and TypeScript