Coder Social home page Coder Social logo

simple-chat-server's Introduction

Simple Chat Room Server

This is an incredibly basic chat room server. There is one chat room and it transmits only basic text.

Endpoints

The server has one main endpoint, /ws/{username}, where username is a string chosen by the user.

Events

Events sent from the server follow a simple format. Each event is a JSON object with two properties: event and data.

  • event is a string that identifies the type of action that is being broadcast
  • data is any additional data associated with the message. For now, data will either be an object or a string.

Event Types

  • user_joined is sent when a new user enters the room. It's data is the new user's username as a string.
  • user_left is sent when a user leaves. It's data is the username of the user that left as a string.
  • new_message is sent when a user sends a message. It's data is an object with properies sent_by and text, both of which are strings.

Run locally

To run this project, make sure you have virtualenv installed.

virtualenv venv
source venv/bin/activate
pip3 install -r requirements.txt
uvicorn app.main:app

Visit localhost:8080 in your browser to make sure it worked.

Run with Docker

docker build -t <container_name> .
docker run -dp 8080:8080 <container_name>

Visit localhost:8080 in your browser to make sure it's running properly.

simple-chat-server's People

Watchers

James Cloos avatar Cooper Weiser 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.