gemini / chat-api
A coroutine framework that focuses on hyperspeed and flexible, specifically use for build microservices and middlewares.
v1.0.1
2021-11-09 09:53 UTC
Requires
- php: >=8.0
- ext-json: *
- ext-openssl: *
- ext-pdo: *
- ext-pdo_mysql: *
- ext-redis: *
- ext-swoole: >=4.5
- hyperf/amqp: 2.2.*
- hyperf/async-queue: 2.2.*
- hyperf/cache: 2.2.*
- hyperf/command: 2.2.*
- hyperf/config: 2.2.*
- hyperf/constants: 2.2.*
- hyperf/contract: 2.2.*
- hyperf/database: 2.2.*
- hyperf/db-connection: 2.2.*
- hyperf/di: 2.2.*
- hyperf/dispatcher: 2.2.*
- hyperf/event: 2.2.*
- hyperf/exception-handler: 2.2.*
- hyperf/framework: 2.2.*
- hyperf/guzzle: 2.2.*
- hyperf/http-server: 2.2.*
- hyperf/logger: 2.2.*
- hyperf/model-cache: 2.2.*
- hyperf/nsq: 2.2.*
- hyperf/pool: 2.2.*
- hyperf/process: 2.2.*
- hyperf/redis: 2.2.*
- hyperf/server: 2.2.*
- hyperf/utils: 2.2.*
- hyperf/websocket-server: 2.2.*
- limingxinleo/hyperf-utils: ^3.1
- limingxinleo/redis-collection: ^1.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- hyperf/devtool: 2.2.*
- hyperf/ide-helper: 2.2.*
- hyperf/testing: 2.2.*
- hyperf/websocket-client: 2.2.*
- mockery/mockery: ^1.0
- phpstan/phpstan: ^1.0
- swoole/ide-helper: dev-master
- symfony/var-dumper: ^5.1
This package is auto-updated.
Last update: 2024-11-30 01:47:13 UTC
README
本系统支持 NSQ 和 AMQP 两种消费协议,可以通过修改 CONSUMER_ENGINE
环境变量进行切换,推荐使用 AMQP
。
连接
ws://127.0.0.1:9501/?token=xxx
协议
查看所有用户列表
{"protocal":"user.list","data":"Hello World"}
向对方用户发送消息
{"protocal":"send.message","data":{"id":2,"message":"Hello World."}}
测试
启动两个服务,分别使用端口 9501 和 9502
让客户端A使用以下连接,连接 9501 端口
ws://127.0.0.1:9501/?token=1
让客户端B使用以下连接,连接 9502 端口
ws://127.0.0.1:9502/?token=2
使用客户端 A 发送协议
{"protocal":"send.message","data":{"id":2,"message":"Hello World."}}
客户端 B 即可收到消息