cryhac/socket-service

[](#socket-service)socket-service

基于workerman-chat的GatewayWorker框架开发的一款高性能支持分布式部署的socket推送服务。

GatewayWorker框架文档:http://www.workerman.net/gatewaydoc/

[](#%E7%89%B9%E6%80%A7)特性

  • 使用websocket协议
  • 多频道支持
  • 订阅支持
  • 广播支持
  • 掉线自动重连
  • 支持多服务器部署
  • 消息推送到redis.指定给某个频道的某个用户发送消息,支持广播频道的广播消息

[](#%E4%B8%8B%E8%BD%BD%E5%AE%89%E8%A3%85)下载安装

1、git clone https://github.com/cryhac/socket-service

2、composer install

3、修改redis的配置信息。Applications/Config/config.php

[](#%E5%90%AF%E5%8A%A8%E5%81%9C%E6%AD%A2linux%E7%B3%BB%E7%BB%9F)启动停止(Linux系统)

以debug方式启动
php start.php start

以daemon方式启动
php start.php start -d

[](#%E6%B5%8B%E8%AF%95)测试

使用chrome的扩展Smart Websocket Client

默认地址:ws://127.0.0.1:7272/

登录:{"type":"login","uid":5,"channel":"channel1"} 发送消息测试 使用php test.php

登录:{"type":"login","uid":5,"channel":"broadcast"} 发送消息测试 使用php test.php

[](#%E6%97%A5%E5%BF%97)日志

日志默认记录在log/service.log文件中

[](#%E5%A3%B0%E6%98%8E)声明

此项目旨在给学习使用workerman的提供一个参考实例。并没有经过生产环境的 大量测试,请酌情使用。

[](#todo)todo

目前暂时没有做鉴权行为。如果有需要。下次加上。


原网址: 访问
创建于: 2019-04-07 23:13:28
目录: default
标签: 无

请先后发表评论
  • 最新评论
  • 总共0条评论