Giter Site home page Giter Site logo

chattex's Introduction

Example Chat Server in Elixir

This is an example chat server written in Elixir. It is not for production, but is useful for exploring and learning about Elixir and OTP.

The chat server utilizes :gen_tcp, which is the Erlang provided module that gives us communication over TCP. Intimidating at first, my hope is that this project can provide insight in using this module, along with GenServers.

The chat server consists of 4 components:

The Connection Dispatcher

The connection dispatcher awaits for new TCP connections, and when one is avaialable, hands the new connection off to the client registrar.

The Client Registrar

The client registrar handles the coordination of client server. The register first asks the client for a name, and if valid, assigns that process to a client server, while monitoring the client server process for termination.

The Client Server

A client server is a process that represents the TCP socket, and data flowing to and from the client to the chat server.

The Chat Server

The chat server coordinates the messages from a client to other clients, and shared state. Notice that the client registrar and the chat server could actually be combined into one process, but I chose to separate them.

To Test

make test

To Run

make run

To Connect

make telnet

chattex's People

Contributors

blbrodie avatar

Watchers

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