项目
在 GitHub 查看
kthwaite/fastapi-websocket-broadcast
关于
Websocket 'broadcast' demo using FastAPI/Starlette
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文fastapi-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
探索相关项目
加载中…