Skip to content

Crash Course on realtime communication using websockets on nodejs and express.

Notifications You must be signed in to change notification settings

jocnjr/chat-app-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chat App on Node.js

A simple web chat based on socket.io and Node.js

Tech Stack

Setup

$ npm install
$ npm start
$ open http://localhost:3000/

Open the browser http://localhost:3000.

1 - The Basics

Understand the basic data exchange between server and client using socket.

We'll undestand how Node.js deals with events and exchange data.

2 - The Timer

We'll send random data and percieve the "real time" feeling.

3 - The Chat

Finally. Here's the chat:

  • sending data from html from input
  • broadcast data back to all clients

Replace this code on your index.hbs file at: views/index.hbs

<section class="section">
  <div class="container-fluid">
    <h1 class="title">
      {{title}}
    </h1>
    <p class="subtitle">
      welcome to {{title}}!
    </p>
    <div class="content" id="message"></div>
    <hr>
    <div class="field">
      <div class="control">
        <input class="input is-primary is-medium" type="text" name="message" placeholder="type your message">
      </div>
    </div>
    <button class="button is-primary">Send Message</button>
  </div>
</section>

About me

Get in touch with me.

About

Crash Course on realtime communication using websockets on nodejs and express.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published