Giter Club home page Giter Club logo

cacophony's Introduction

Cacophony


Cacophony is a Full Stack clone of the text portion of Discord. Cacophony allows a user to make an account in order to live message other users both in servers' channels as well as through direct messages. A user can either create their own server or join an existing public server. Server owners can also create/edit channels to organize the many conversations happening between members.

See what all the Cacophony is about!

Splash

Key Features

Live Chat

Users can chat in real-time through WebSockets implemented by Action Cables. This is achieved by utilizing React life cycle methods and Action Cables. When a component mounts, a cable subscription is set up, when the component is updated, the subscription is unsubscribed and then resubscribed with the new params, and finally when the component unmounts the subscription is removed.

  // Inside a React Class Component containing a channel's messages or dms
  componentDidMount(){
    this.props.fetchChannel(this.props.channelId);
    this.subscribe()
  }
  
 componentDidUpdate(prevProps){
      if(PrevProps !== this.props){
      this.unsubscribe();
      this.subscribe();
      // Refetch Channel to make sure the proper messages are displayed
      this.props.fetchChannel(this.props.match.params.channelId)
     }
 }
 
  componentWillUnmount(){
    this.unsubscribe()
  }
  

Live Chat Demo

Creating Servers

The trickiest part of creating servers was having the app land on the right page after the server was created, i.e., push the route to the server's first channel. However, before the backend creates the server (and in turn the server's first channel), the frontend cannot reroute properly as it does not know the id of the new server nor the id of the server's first channel. To solve this problem, Cacophony waits for the promise of the createServer Function to properly push the frontend with the response data from the server creation.

   // In the server form component, this function handles the submitting of server creation form
    e.preventDefault();
    let that = this;
    // action = createServer function
    this.props.action(this.state).then(function(action){
      let server  = action.server.server
      return that.props.history.push(`/servers/${server.id}/${server.firstChannelId}`);
    });

Server Creation

Technologies Implemented


  • Frontend
    • React and Redux for frontend state management and component rendering
    • HTML for creating the skeleton of the React Components and App as a whole
    • CSS to provide intuitive and user-friendly styling and interface
    • JavaScript to provide the logic necessary for dynamically updating the frontend
  • Backend
    • Rails for a robust backend web application framework
    • Ruby for handling backend and database updating logic
    • PostgresSQL for lightweight data storage and manipulation
  • Full Stack
    • Action Cables for live messaging
    • Heroku for hosting and production

Planned Features


  • Start a dm through seraching a username and number tag.
  • Join servers by invite/name.

Acknowledgments


The author would like to acknowledge that the following were invaluable to understanding and using the concepts that made Cacophony possible:

  • Utilizing Action Cables
  • Deploying Action Cables to Heroku
  • All images used were from Discord and used for educational purposes.
  • All my friends who live tested Cacophony and gave valuable user feedback.
  • A special thanks goes out to Jonathan W and Nick P for keeping the author sane during development and always being down to help squash some bugs.

cacophony's People

Contributors

codydegraffeniles 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.