Skip to content

JasterV/chat-rooms-actix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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: wss://rusty-messaging.herokuapp.com/

Please, connect over wss whenever you can since it is enabled on the server

Send messages

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

{
    "ty": "<type>",
    "data": "<message>"
}

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

Releases

No releases published

Packages

No packages published