GithubHelp home page GithubHelp logo

bajocode / websocketchatapp Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 1.59 MB

:speech_balloon: A chat app experiment consisting of a Node.js server and a JavaScript app running in the browser

License: MIT License

HTML 16.22% JavaScript 77.53% CSS 6.25%
javascript websocket-server websocket-client node-js es6 babel-es6 server-side client-side

websocketchatapp's Introduction

WebsocketChatApp

Screenshot of the app

A chat app experiment consisting of a Node.js server and a JavaScript app running in the browser.

Configuration

Building

  1. Navigate to the project root directory
  2. run $ npm install
  3. run $ npm run dev to start the node server with nodemon (auto server restart after file change)
  4. Open a new terminal tab and run $ npm run watch (auto-rebuild with babel compiler)

Executing

  1. Open a new browser and navigate to http://localhost:3000/
  2. Enter a email address as your chat username
    • Ideally an email address bound to a Gravatar account
  3. Each new browser tab kicks of a new socket stream, binding to ws port 3001 connecting to chat room 1 by default
  4. User starts in room 1, switch chat rooms with the dropdown

Architecture

Server Side

HTTP server
  • Handle HTTP requests & transform file-paths
  • Import websocket-server
  • Websocket Server
    • Listens to new client socket connections
    • Registers users and places them in rooms
    • Broadcasts messages and configures new users with message history

Client Side

App Module
  • Define the structure of messages
  • Pass messages between client socket class and DOM
DOM Module
  • Queries the DOM, and acts as interface to App module
Websocket Client Module
  • Manage WebSockets communication for the client
  • Connection handlers, message handlers etc.

Screenshot of the app

ToDo

  • Better styling, throw away bootstrap
  • Add cool chat features found in popular apps, such as, Slack

websocketchatapp's People

Contributors

bajocode avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.