ktamas77 / firebase-php

Firebase PHP Client
792 stars 215 forks source link

Reuse curl handle to improve performance; fixes #14 #15

Closed kijin closed 8 years ago

kijin commented 10 years ago

I removed all instances of curl_close() and turned $ch into a property so that the HTTP connection will stay open (using KeepAlive) throughout the lifetime of the object.

All unit tests seem to be passing, but there may be special cases not covered by the tests (e.g. what if the server drops the connection in between two requests?) so very thorough testing is recommended.

rdibona commented 9 years ago

This was a very helpful change. Thank you. I updated my app with your modified file and all works fine and faster.

rdibona commented 9 years ago

@kijin I added a closeConnection method to your class so I could properly close out the CURL to free up the firebase connection: public function closeConnection() { if ($this->_ch) { curl_close($this->_ch); } }

kijin commented 9 years ago

closeConnection looks like a very nice addition. Thanks for the input!

ktamas77 commented 9 years ago

Unfortunately I can't merge your pull request in this state. Can you please bring your code up-to-date?

ktamas77 commented 8 years ago

This feature is supported from v2.2.0