No description
Find a file
Víctor Martínez 7b283dd39e readme update
2021-03-21 22:13:36 +01:00
src heroku deployment fix & release 2021-03-21 21:55:47 +01:00
.gitignore first commit 2021-03-06 21:26:56 +01:00
Cargo.lock refactor 2021-03-07 21:27:29 +01:00
Cargo.toml refactor 2021-03-07 21:27:29 +01:00
Dockerfile origin changed 2021-03-21 20:42:10 +01:00
heroku.yml heroku deployment fix & release 2021-03-21 21:55:47 +01:00
README.md readme update 2021-03-21 22:13:36 +01:00

Actix Chat rooms

Chat room application backend which allows you to create, join, leave chat rooms & send message to other anonymous users. Built using Actix Web, Actix & Actix WebSocket actors

Build

cargo build

Run

cargo run

How to interact with the app

Connect

First, you will need to connect to the app by web socket:

Ex: ws://localhost:<$PORT>

Send messages

To execute any operation you have to send a json which has the following format:

{
    "ty": "Create" | "Join" | "Leave" | "Msg",
    "data": ""
}

Available operations

  • Create a room:

    {
        "ty": "Create",
        "data": ""
    }
    
    • Response:
      {
          "ty": "Info",
          "data": <room-id>
      }
      
  • Join a room:

    {
        "ty": "Join",
        "data": <room-id>
    }
    
    • Response:
      {
          "ty": "Info",
          "data": "Joined"
      }
      
  • Leave a room:

    {
        "ty": "Leave",
        "data": ""
    }
    
    • Response:
      {
          "ty": "Info",
          "data": "Room leaved"
      }
      
  • Send a msg to the room:

    {
        "ty": "Msg",
        "data": "Hello, World"
    }
    

Error responses

If an error occurs, the server will send back a json with the following format:

{
    "ty": "Err",
    "data" <error-message>
}

Todo List

  • Add a redis db to store messages & active rooms