k8s / ws-swoole
Swoole 基于的 k8s/client 的 WebSocket 适配器
1.1.1
2023-10-01 15:00 UTC
Requires
- php: >=7.2
- ext-swoole: *
- k8s/core: ^1.3
Requires (Dev)
- ext-mbstring: *
- friendsofphp/php-cs-fixer: ^2.0
- mockery/mockery: ~1.3.0
- phpstan/phpstan: ^0.12.79
- phpunit/phpunit: ^8.0|^9.5
- swoole/ide-helper: ^4.6
This package is auto-updated.
Last update: 2024-08-30 01:32:22 UTC
README
此库为 k8s/client
库提供了一个基于 Swoole 的 WebSocket 适配器。
与 K8s 库的一般使用/配置选项
- 安装库
composer require k8s/ws-swoole
注意:如果您不需要更改任何 TLS 设置,这可能是您需要的全部。
- 如果您需要配置任何选项,则可以使用以下方法设置这些选项并使用 WebSocket 与它们一起使用
use K8s\Client\K8s; use K8s\Client\Options; use K8s\WsSwoole\CoroutineAdapter; $options = [ # May need to toggle SSL verification settings if using a self-signed cert, like for Minikube 'ssl_allow_self_signed' => true, 'ssl_verify_peer' => false, 'verify_peer' => false, 'verify_peer_name' => false, # To use certificate based auth, you may need to pass in the cert locations. 'ssl_cert_file' => '<home-dir>/.minikube/profiles/minikube/client.crt', 'ssl_key_file' => '/<home-dir>/.minikube/profiles/minikube/client.key', ]; $websocket = new CoroutineAdapter($options); # You can then pass the new websocket adapter in the options to be used $options = new Options('k8s.endpoint.local'); $options->setWebsocketClient($websocket); # Construct K8s to use the new websocket in the options $k8s = new K8s($options);