k8s / ws-ratchet
Ratchet based websocket adapter for k8s/client
Installs: 1 987
Dependents: 1
Suggesters: 1
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.2
- k8s/core: ^1.3
- ratchet/pawl: ^0.3|^0.4
Requires (Dev)
- ext-mbstring: *
- friendsofphp/php-cs-fixer: ^2.0
- mockery/mockery: ~1.3.0
- phpstan/phpstan: ^0.12
- phpunit/phpunit: ^8.0
README
This library provides a Ratchet based websocket adapter for the k8s/client
library.
General Use with the K8s library / Configuration Options
- Install the library:
composer require k8s/ws-ratchet
Note: If you don't need to change any TLS settings, this is all that is needed.
- If you need to configure any options, then you can use the below method to set those and use the websocket with them:
use K8s\Client\K8s; use K8s\Client\Options; use K8s\WsRatchet\RatchetWebsocketAdapter; $options = [ # Set a timeout for the websocket connection 'timeout' => 15, # Can toggle these to false if you are using a self-signed cert 'tls' => [ 'verify_peer' => true, 'verify_peer_name' => true, ], ]; $websocket = new RatchetWebsocketAdapter($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);