pradosoft / prado

Prado - Component Framework for PHP
Other
187 stars 70 forks source link

THttpRequest::onResolveRequest for application specific request => service resolution #977

Closed belisoful closed 1 year ago

belisoful commented 1 year ago

In some instances, subclassing the HttpRequest isn't flexible enough to "append service resolution" functionality.

A developer may have a specific HttpRequest subclass and want to add a WebSockets layer to the Http Request... a double sub class isn't possible.

This adds an application layer to service resolution for custom service discovery.

belisoful commented 1 year ago

a webSocket service can be activated by designating a URL parameter, there should be a behavior (and thus an event) for manipulating the URL Parameters and providing for custom application service selection without subclassing.

A TRequestConnectionUpgrade behavior for THttpRequest for injecting the Upgrade http header into the $getParam.

I have the unit tests for this working. It needs a custom parameter class for the onResolveRequest event.

there should be a way to override the serviceID resolution and cancel as well as manipulating the URL parameters.

ctrlaltca commented 1 year ago

To be honest i always used multiple services for this scenario (a page service, a json service, etc..), but i'm really looking forward to see what you are creating here.

belisoful commented 1 year ago

I'm glad you like it. It adds a subtlety to resolveRequest that's been needed. The included Behavior is a great example of how it is to be used.