Skip to content

darkhaniop/starlette-chat-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

starlette-chat-sample

The purpose of this project is to check a minimal Starlette-based chat app functionality. It also verifies the full-duplex communication capability over WebSockets.

Note

This is only a basic example of a Starlette app, and not meant to be deployed for production.

Usage

Start the server:

python app/main.py

In a web-browser, navigate to localhost:8080/chat. Messages would be received by all connected clients.

Usage with FastAPI

Since FastAPI uses Starlette under the hood, this sample can be easily adapted to work with FastAPI.

Limitations

As stated in the note above, this app is not meant to be used as is. One of the limitations of the current implementation is the fact that upon receiving a new message, the server would attempt to send it to all previously connected clients in sequence. Which means that some clients would experience unnecesssary delays. Furthermore, the server does not skip already disconnected clients, which would introduce extra delays caused by socket errors.

About

The purpose of this project is to check a minimal Starlette-based chat app functionality.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages