Projects
View on GitHub
kthwaite/fastapi-websocket-broadcast
About
Websocket 'broadcast' demo using FastAPI/Starlette
Web & AppsMeasured star growth
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Originalfastapi-websocket-broadcast
An example of the familiar 'chat' websocket demo app, implemented in FastAPI / Starlette.
Run with
uvicorn app:app
And then point your browser to http://localhost:8000. REST API documentation is available under the /docs endpoint.
Websocket interface
Data from the server is JSON in the form
{
"type": ...,
"data": {
...
}
}
Where type is one of:
- ROOM_JOIN - sent to a user on successfully joining the chatroom
- USER_JOIN - sent to all chatroom users when a new user joins the chatroom
- USER_LEAVE - sent to all chatroom users when a user leaves the chatroom
- ERROR - sent to one or more users in the event of a server error
- MESSAGE - chat message from one user, broadcast to all chatroom users
- WHISPER - private message from one user to another
Explore related projects
Loading…