Telichkin / simple_chat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flask-SocketIO Chat Backend

Installation

Both Docker and docker-compose should be installed.

git clone https://github.com/Telichkin/simple_chat.git
cd simple_chat
docker-compose build
docker-compose up

Application will run on http://localhost:8000

API

User creation:

POST /users/
Content-Type: application/json

{"username": "newUser", "password": "Weak!"}

Authentication:

POST /auth/
Content-Type: application/json

{"username": "matureUser", "password": "Strong?"}

Both creation and authentication methods return token in response body.

Backend can get events:

/

event required payload fields
"auth" "token"
"send private message" "message", "to"
"broadcast" "message"
"connect" None
"disconnect" None

Before start to use other events you need to authenticate through "auth" event with token.

/active-users

event required payload fields
"connect" None
"disconnect" None

Backend can send events:

/

event data
"send private message" {"message": .., "author": .., "to": ..}
"broadcast" {"message": .., "author": .., "to": None}
"private history" list with messages from "send private message"
"broadcast history" list with messages from "broadcast"
"error" error message

/active-users

event data
"update" list with user names of active users

About


Languages

Language:Python 100.0%