voryx / Thruway

PHP Client and Router Library for Autobahn and WAMP (Web Application Messaging Protocol) for Real-Time Application Messaging
MIT License
676 stars 117 forks source link

Subscription meta events #362

Open Ethorsen opened 2 years ago

Ethorsen commented 2 years ago

Following my question at https://github.com/voryx/Thruway/issues/361

Added some meta events to the router, from the Subscription Meta API.

Refs: https://wamp-proto.org/_static/gen/wamp_latest.html#subscription-meta-events https://crossbar.io/docs/Subscription-Meta-Events-and-Procedures/?highlight=meta#events

Did not add the subscription_meta_api to the broker as this is only a partial implementation of the whole API. It does not include the api Procedures.

Might implement the procedures in a near future.

Usage

$session->subscribe("wamp.metaevent.subscription.on_subscribe", $callbackFn);
$session->subscribe("wamp.metaevent.subscription.on_unsubscribe", $callbackFn);
$session->subscribe("wamp.metaevent.subscription.on_create", $callbackFn);
$session->subscribe("wamp.metaevent.subscription.on_delete", $callbackFn);

$callbackFn will receive $args as first argument where $args[0] = session meta information (the session that triggered the event) $args[1] = subscription meta information [ uri: string, match: string ]