Showing posts with label websocket. Show all posts
Showing posts with label websocket. Show all posts

Saturday, January 27, 2024

Real time chat

In a web application, real time chat, i.e. sending/receiving messages without database polling and refreshing the page, can be implemented with socket.io as follows:
Note that besides a web server, you also need a chat server that coordinates messages and sends requests to web server to save chat messages to database.