Giter Club home page Giter Club logo

echat's Introduction

Project Chat Server

Approach :

Used websockets throughout the project. From login, signup to signup, chatting, everything is communicated from client interface to backend erlang chat server is via websockets. I used it because to get myself more familiarized with websockets( since there are better ways to handle login signup etc. ).

The Flow : The client interface(frontend) static files is hosted via the Cowboy server.

The backend ( gen_server ) is connected to it and has many handlers which handle events from the frontend.

The backend then, whenever required, talks to the Mnesia dB for various data requirements and returns the apt values which then the handler handles and returns results to the respective interfaces.

Backend : The Application Supervisor manages the server and application. The gen_server is started and cowboy handles the connections. Cowboy spawns separate processes for each connection, makes them communicate with the server to exchange messages. The information stored in Mnesia database are : user {username,password} -> for login/signup check. chatroom {cname,id} -> for chatroom names. in_chatroom {chatroom,users = []} -> for getting users inside a chatroom. userpid {username,pid} -> for sending messages to particular users inside a chatroom.

Overview : Users can create unique usernames with passwords through signup page and then after login using the same, user is redirected to the chatrooms page. Here all the existing chatroom names appear. User can either join one or create a new one. Either choice redirects to the main chatroom page. Now the user can chat on the main page and leave the chatroom.

There is also a Admin page which can delete users and chatrooms.

Improvements that can be done: Show statistics of users, chatrooms like number of messages, number of chatrooms etc. Use RESTAPI or other better handlers for login/signup.

echat's People

Contributors

roydeb avatar

Watchers

NIlanjan Chakraborty 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.