georgique / yii2-jsonrpc

Yii2 JSON-RPC server implementation based on method-to-action translation.
BSD 2-Clause "Simplified" License
9 stars 8 forks source link

Add hook to allow custom response objects #11

Open cboulanger opened 4 years ago

cboulanger commented 4 years ago

Hi, I am still using the library and it works excellently. There is one reason why I am still using a fork, though, which is that I need a custom NotificationResponse (see the diff) and I wonder how best to go about in order to return to upstream. Since my use case is probably too special for integration, maybe the best solution is if you could add a hook that would allow to insert custom response objects into the batch at any time (not only as the result of an action).

Thank you for considering this enhancement.

georgique commented 4 years ago

@cboulanger I'd happy to implement this, but currently being pretty busy at other projects. If you manage to provide a pull request, I should be able to review it and accept, whereas working on this myself - just don't have time at the moment

cboulanger commented 4 years ago

Do you have any preference as to how this should be implemented? I my current implementation, I use a static method of the controller to add to a list of NotificationResponses which will be added to the batch before the response is returned to the client.