From af25b10b04eda3c8152b7ddc30eacba124d04b9e Mon Sep 17 00:00:00 2001 From: Gerardo Marx Date: Thu, 9 Nov 2023 00:35:47 +0000 Subject: [PATCH] Chat-io 2023 --- Readme.md | 23 +++++++++++++++++++++++ package.json | 4 +--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index e69de29..278fe0c 100644 --- a/Readme.md +++ b/Readme.md @@ -0,0 +1,23 @@ +# Get Started +In this guide we’ll create a basic chat application. It requires almost no basic prior knowledge of Node.JS or Socket.IO, so it’s ideal for users of all knowledge levels. + +## Introduction +Writing a chat application with popular web applications stacks like LAMP (PHP) has normally been very hard. It involves polling the server for changes, keeping track of timestamps, and it’s a lot slower than it should be. + +Sockets have traditionally been the solution around which most real-time chat systems are architected, providing a bi-directional communication channel between a client and a server. + +This means that the server can push messages to clients. Whenever you write a chat message, the idea is that the server will get it and push it to all other connected clients. + +# The Web Framework +The first goal is to set up a simple HTML webpage that serves out a form and a list of messages. We’re going to use the Node.JS web framework `express` to this end. Make sure *Node.JS* is installed. + +First let’s create a `package.json` manifest file that describes our project. I recommend you place it in a dedicated empty directory (I’ll call mine `chat-example`). + +``` +{ + "name": "socket-chat-example", + "version": "0.0.1", + "description": "my first socket.io app", + "dependencies": {} +} +``` diff --git a/package.json b/package.json index 92810b3..3bc49b8 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,5 @@ "name": "socket-chat-example", "version": "0.0.1", "description": "my first socket.io app", - "dependencies": { - "socket.io": "^4.4.1" - } + "dependencies": {} }