Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change creates a Thruway-specific feature that allows for the hooking of RPCs.
A client can register an RPC that will receive calls for an already existing RPC. The client can then choose to service the call itself or it can call the original hooked RPC (either using it's own session context or the original session's context).
The use case for this feature are similar to hooking in any other environment. (debugging, extending functionality without changing the original RPC, etc.)
Usage:
Hook an existing RPC by registering a new RPC with the same name and the option:
'x_thruway_hook' => true
. This registration will then receive all calls to that RPC.These
INVOCATION
s can be handled as a normal RPC if desired. The existing registration will not receive theINVOCATION
s.The hooked registration can also call the underlying RPC by making a call with the option:
['x_thruway_call_hooked' => (object)[ 'registration_id' => $hookRegistrationId ]]
and can call the underlying RPC with the session context of the caller using: