基于SignalR实现聊天通信,支持横向扩展,可支撑上万用户同时在线聊天
http://server.tokengo.top:8888/ 可在这里快速体验使用,请注意目前只适配了PC端,请勿使用手机访问,可能出现样式不适应的情况,
当然如果你想要自己部署也可以,目前提供了docker compose镜像一键部署
下面是docker-compose
代码
services:
postgres:
image: postgres:15.3-alpine3.18
restart: always
container_name: postgres
ports:
- 5432:5432
networks:
- chat
environment:
POSTGRES_USER: token
POSTGRES_PASSWORD: dd666666
POSTGRES_DB: Chat
volumes:
- ./postgres_data:/var/lib/postgresql/data
redis:
image: redis:alpine3.16
restart: always
container_name: redis
ports:
- 6379:6379
networks:
- chat
command: redis-server --appendonly yes
volumes:
- ./redisdata:/data
nginx:
image: nginx:stable-alpine
restart: always
container_name: nginx
networks:
- chat
ports:
- 1080:80
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
chat-web:
build:
context: ./web
dockerfile: ./Dockerfile
container_name: chat-web
image: registry.cn-shenzhen.aliyuncs.com/gotrays/chat-web
restart: always
depends_on:
- redis
- postgres
networks:
- chat
chat-api:
build:
context: ./
dockerfile: ./src/Chat.Service/Dockerfile
container_name: chat-api
image: registry.cn-shenzhen.aliyuncs.com/gotrays/chat-api
restart: always
depends_on:
- redis
- postgres
networks:
- chat
networks:
chat:
driver: bridge
注,容器并不会一次性启动成功,可能由首次启动的时候postgres未初始化成功导致Api服务启动失败,可能需要重启服务
后端技术栈采用
Web界面预览,
并且输入框支持直接cv图片,当我们点击发送的时候会将图片和文字拆分发送。
后端项目结构
gitee:https://gitee.com/hejiale010426/chat
github https://github.com/239573049/chat
技术交流群 :737776595