-
Notifications
You must be signed in to change notification settings - Fork 204
Description
Currently the BigBlueButton::sendRequest() is hard-coded to use curl_*() methods.
We are working on an integration in Drupal, where we would like to use the (Guzzle) http client service from the DI container.
This is currently difficult, because the relevant methods in BigBlueButton are private. So to solve this with inheritance, we have to replace a bunch of methods that call the private methods.
Proposed change
A good solution would be to split out a part of the BigBlueButton class, most importantly the sendRequest() method, and then inject that new object into the BigBlueButton class.
We can keep the default implementation with curl_*(), and provide an alternative implementation with a PSR-18 http client.
Once we factor out that new object, the signature of ->sendRequest() (or a renamed version of that) will become part of the public API and we can no longer change it.
Alternatively, we could inject an optional PSR-18 client into BigBlueButton, and fall back to curl if no client was provided.
EDIT: If we want to keep all options on the table, we can add a static factory method BigBlueButton::createWithHttpClient(..) which for now would create a new instance with a http client property. Later if we refactor by splitting out sendRequest() into a separate class, we can leave the signature of that static method unchanged.
Challenges, obstacles
I noticed that the ->sendRequest() method changes object variables by calling $this->setJSessionId(), which results in the object not being stateless anymore . I don't really know what we need this for. We should avoid statefulness, or handle it in a smart way, if we want this to be usable as a service
Next steps
I am going to work on a PR, but I also want to open this issue to collect some thoughts from maintainers.