allansun/websocket
Composer 安装命令:
composer require allansun/websocket
包简介
WebSocket client and server
README 文档
README
This package mainly contains a WebSocket client for PHP.
I made it because the state of other WebSocket clients I could found was either very poor (sometimes failing on large frames) or had huge dependencies (React…).
The Client should be good. If it isn't, tell me!
The Server there because much of the code would be identical in writing a server, and because it is used for the tests. To be really useful though, there should be a Connection-class returned from a new Connection, and the Server-class only handling the handshake. Then you could hold a full array of Connections and check them periodically for new data, send something to them all or fork off a process handling one connection. But, I have no use for that right now. (Actually, I would suggest a language with better asynchronous handling than PHP for that.)
Installing
Preferred way to install is with Composer.
Just add
"require": {
"allansun/websocket": "1.*"
}
in your projects composer.json.
Client usage:
require('vendor/autoload.php'); use WebSocket\Client; $client = new Client("ws://echo.websocket.org/"); $client->send("Hello WebSocket.org!"); echo $client->receive(); // Will output 'Hello WebSocket.org!'
Developer install
Development depends on php, php-curl and php-xdebug.
# Will get composer, install dependencies and run tests make test
License (ISC)
Copyright (C) 2014, 2015 Textalk Copyright (C) 2015 Patrick McCarren - added payload fragmentation for huge payloads Copyright (C) 2015 Ignas Bernotas - added stream context options
Websocket PHP is free software: Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
See COPYING.
Changelog
1.2.0
- Adding stream context options (to set e.g. SSL
allow_self_signed).
1.1.2
- Fixed error message on broken frame.
1.1.1
- Adding license information.
1.1.0
- Supporting huge payloads.
1.0.3
- Bugfix: Correcting address in error-message
1.0.2
- Bugfix: Add port in request-header.
1.0.1
- Fixing a bug from empty payloads.
1.0.0
- Release as production ready.
- Adding option to set/override headers.
- Supporting basic authentication from user:pass in URL.
allansun/websocket 适用场景与选型建议
allansun/websocket 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.52k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2016 年 02 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 allansun/websocket 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 allansun/websocket 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.52k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-02-17