octamp/wamp
Composer 安装命令:
composer create-project octamp/wamp
包简介
WAMP Router
README 文档
README
Octamp WAMP is Router implementation of WAMP Protocol that scalable.
This was implemented using PHP OpenSwoole
Currently, the Adapter use for this is Redis.
Why Use Octamp Wamp
Octamp Wamp is created using PHP with OpenSwoole instead of Ratchet / React PHP.
Octamp Wamp also support Horizontal Scaling with the help of Redis.
Session data and Wamp Datas will be save in Redis so that all node / server can access it.
Comparison with other Implementation
| Octamp Wamp | Thruway | |
|---|---|---|
| Horizontal Scalling | ✓ | ✗ |
| Uses OpenSwoole | ✓ | ✗ |
| Uses React PHP | ✗ | ✓ |
Profile
Octamp Wamp currently implemented using Basic Profile and Advance Profile and of WAMP Proto.
How to use
Prerequisite
- PHP 8.2
- Redis Stack with Pub/Sub
- Openswoole
Installation
composer create-project octamp/wamp ./wamp
cd ./wamp
This will create the project in wamp folder
You can update the file /configs/adapter.yml or copy to different file
And update the configuration
adapter: type: redis host: 0.0.0.0 port: 6379 # -- Uncomment the auth if you need username and password # auth: # username: # password: # # -- Uncomment options if you need to include other redis option such as database options: database: 0
You can update the file /configs/transport.yml or copy to different file
And update the configuration
transports: - endpoint: type: tcp port: 8080 auths: - method: anonymous type: static # -- You can add more method, such us the examples below # - method: ticket # type: dynamic # authenticator: testing # authenticatorRealm: realm1 # realms: # - realm1 # - method: wampcra # type: static # users: # - authid: auth # secret: qa2/QVmmjSx1JJuyH5EI2gMDQf+ARnfwMcLOpUfln74= # role: auth # salt: salt1 # keylen: 32 # iterations: 1000
You can update the file /configs/realms.yml or copy to different file
And update the configuration
realms: - name: realm1
Copy the file .env to .env.local
Update the necessary data
TRANSPORT_FILE=/configs/transport.yml
ADAPTER_FILE=/configs/adapter.yml
REALM_FILE=/configs/realms.yml
Now run the bin/server
php ./bin/server
That will now run the server
Octamp Wamp Features
- High performance - Uses OpenSwoole, network framework based on an event-driven, asynchronous, non-blocking I/O coroutine programming model for PHP.
- Scalable - Designed for Horizontal Scalability.
- WAMP Basic Profile Features - This project implements most of the basic profile features in WAMP v2.
- Websocket Transport - Currently the project only implements websocket transport.
- Message Serializer - Accepts JSON and MessagePack.
Message Serializer
- JSON
- MessagePack
Basic Profile Feature Support
Sessions
| Feature | Supported |
|---|---|
| Session Establishment | ✓ |
| Session Close / Closing | ✓ |
| Abort | ✓ |
Publish and Subscribe
| Feature | Supported |
|---|---|
| Subscribe | ✓ |
| Unsubscribe | ✓ |
| Subscribe & Unsubscribe Error | ✓ |
| Publish | ✓ |
| Publish Error | ✓ |
Remote Procedure Calls
| Feature | Supported |
|---|---|
| Register | ✓ |
| Unregister | ✓ |
| Call | ✓ |
| Call / Invocation Error | ✓ |
| Caller Leaving | ✓ |
| Callee Leaving | ✓ |
Other Features
| Feature | Supported |
|---|---|
| URI Validation | Partial |
Advance Profile Feature Support
Authentication
| Feature | Static | Dynamic |
|---|---|---|
| Anonymous | ✓ | ✓ |
| Ticket | ✓ | ✓ |
| Wamp-CRA | ✓ | ✓ |
| Wamp-SCRA | ✗ | ✗ |
| Cryptosign | ✗ | ✗ |
| TLS | ✗ | ✗ |
| Cookie | ✗ | ✗ |
Authorization
| Feature | Static |
|---|---|
| Authorization | ✗ |
RPC Features
| Feature | Status |
|---|---|
| Progressive Call Results | ✗ |
| Ignoring Requests for Progressive Call Results | ✗ |
| Progressive Call Results with Timeout | ✗ |
| Progressive Call Invocations | ✗ |
| Call Timeout | ✗ |
| Call Canceling | ✗ |
| Call Re-Routing | ✗ |
| Caller Identification | ✗ |
| Call Trustlevels | ✗ |
| Registration Meta API | ✗ |
| Pattern-based Registration | ✓ |
| Shared Registration | ✓ |
| Sharded Registration | ✗ |
| Registration Revocation | ✗ |
| (Interface) Procedure Reflection | ✗ |
PubSub Features
| Feature | Status |
|---|---|
| Subscriber Blackwhite Listing | ✓ |
| Publisher Exclusion | ✓ |
| Publisher Identification | ✓ |
| Publication Trustlevels | ✗ |
| Subscription Meta API | ✗ |
| Pattern-based Subscription | ✓ |
| Sharded Subscription | ✗ |
| Event History | ✗ |
| Event Retention | ✗ |
| Subscription Revocation | ✗ |
| Session Testament | ✗ |
| (Interface) Topic Reflection | ✗ |
Meta API
| Feature | Event | Procedure |
|---|---|---|
| Session Meta API | ✓ | ✓ |
| Registration Meta API | ✓ | ✗ |
| Subscriptions Meta API | ✗ | ✗ |
Others
| Feature | Status |
|---|---|
| Feature Announcement | ✓ |
| RawSocket Transport | ✗ |
| Batched WebSocket transport | ✗ |
| Call Rerouting | ✗ |
| Payload Passthru Mode | ✗ |
TODOs
- Implement CBOR Serializer https://wamp-proto.org/wamp_bp_latest_ietf.html#name-serializers
- Remove Dependencies from Thruway Common
- Add OpenSwoole Table Adapter as Data Provider
octamp/wamp 适用场景与选型建议
octamp/wamp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 2, 最近一次更新时间为 2024 年 05 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 octamp/wamp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 octamp/wamp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-05-05