Download the PHP package roadrunner/centrifugo without Composer
On this page you can find all versions of the php package roadrunner/centrifugo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download roadrunner/centrifugo
More information about roadrunner/centrifugo
Files in roadrunner/centrifugo
Package centrifugo
Short Description Centrifugo bridge for RoadRunner: handle Centrifugo proxy events in PHP workers and call the Centrifugo server API over RPC
License MIT
Homepage https://roadrunner.dev/
Informations about the package centrifugo
Centrifugo bridge for RoadRunner: proxy events and server API
PHP bridge for the RoadRunner centrifuge plugin: handle Centrifugo proxy events (connect, subscribe, publish, RPC, …) in PHP workers and call the Centrifugo server API over RoadRunner RPC.
Get Started
Installation
You can use the convenient installer to download the latest available compatible version of RoadRunner assembly:
Configuration
Add the centrifuge section to your RoadRunner configuration (.rr.yaml):
and point the Centrifugo proxy endpoints to it:
Note
proxy_connect_endpoint,proxy_publish_endpoint,proxy_subscribe_endpoint,proxy_refresh_endpoint,proxy_sub_refresh_endpoint,proxy_rpc_endpoint- endpoint address of roadrunner server with activatedcentrifugeplugin.
Handling proxy events
Create a worker (app.php) that waits for proxy requests and responds to them:
Proxy events
It's possible to proxy some client connection events from Centrifugo to the RoadRunner application server and react to them in a custom way. For example, it's possible to authenticate connection via request from Centrifugo to application backend, refresh client sessions and answer to RPC calls sent by a client over bidirectional connection.
The list of events that can be proxied:
connect– called when a client connects to Centrifugo, so it's possible to authenticate user, return custom data to a client, subscribe connection to several channels, attach meta information to the connection, and so on. Works for bidirectional and unidirectional transports.refresh- called when a client session is going to expire, so it's possible to prolong it or just let it expire. Can also be used just as a periodical connection liveness callback from Centrifugo to app backend. Works for bidirectional and unidirectional transports.sub_refresh- called when it's time to refresh the subscription. Centrifugo itself will ask your backend about subscription validity instead of subscription refresh workflow on the client-side.subscribe- called when clients try to subscribe on a channel, so it's possible to check permissions and return custom initial subscription data. Works for bidirectional transports only.publish- called when a client tries to publish into a channel, so it's possible to check permissions and optionally modify publication data. Works for bidirectional transports only.rpc- called when a client sends RPC, you can do whatever logic you need based on a client-provided RPC method and params. Works for bidirectional transports only.
Note You can find additional information about proxy events here.
Centrifugo server API
RPCCentrifugoApi calls the Centrifugo server API through the RoadRunner centrifuge plugin, so grpc_api_address must point to the Centrifugo gRPC API (enabled with "grpc_api": true in the Centrifugo config).
All versions of centrifugo with dependencies
ext-json Version *
google/protobuf Version ^3.7 || ^4.0 || ^5.0
roadrunner/api-dto Version ^2.1
roadrunner/goridge Version ^4.5
roadrunner/roadrunner Version ^3.0
roadrunner/worker Version ^3.8