Code Monkey home page Code Monkey logo

Comments (6)

jorgeborges avatar jorgeborges commented on June 18, 2024

It may have to do with the guzzlehttp implementation, yes. This was done in this PR:
#6

A quick google of the issue guided me to this thread where I see you commented as well, I can see in our code that we are not using that tick method mentioned.
guzzle/guzzle#1127

I'll look at this over the next few days, but if you think you can fix it feel free to open a PR for it.

from php-ga-measurement-protocol.

borkor avatar borkor commented on June 18, 2024

Asynchronous method should removed from future releases.

There are a whole bunch of issues in guzzle implementation regarding async requests.
As it is now in php-ga-measurement-protocol it is misleading and making people believe this works as reactphp/promise.

Down to the point. Curl implementation in PHP is not asynchronous.

from php-ga-measurement-protocol.

jorgeborges avatar jorgeborges commented on June 18, 2024

I'll remove it from the current README for the time being...

I'm pretty sure this was working as I test it personally in v1 using Guzzle 5, I think it was indeed using ReactPHP along with promises, check out the composer.lock to see that it was being required before https://github.com/theiconic/php-ga-measurement-protocol/blob/v1/composer.lock

However, it seems to have broken when we upgraded to Guzzle 6, if you check the current composer.lock, React is not there anymore.

I found a good article on how to make Guzzle 6 async using React: http://stephencoakley.com/2015/06/11/integrating-guzzle-6-asynchronous-requests-with-reactphp

But then again, I also want to implement Http Plug to not couple with Guzzle anymore http://httplug.io/

I'll study these options and see if I fix it or remove it altogether from the next big release. Thanks @borkor for reporting the bug.

from php-ga-measurement-protocol.

yellow1912 avatar yellow1912 commented on June 18, 2024

In general, you have to call wait() for the async requests with Guzzle (which kinda destroy the purpose)....

from php-ga-measurement-protocol.

lapswr avatar lapswr commented on June 18, 2024

so this bug still exists, I guess it's possible to fix?

from php-ga-measurement-protocol.

Daniel15 avatar Daniel15 commented on June 18, 2024

If async isn't working, the approach I'd take is to send all your analytics events after flushing the response, so that they don't slow down the page response time. If you're using PHP-FPM, you can flush the response using fastcgi_finish_request(). This sends the response to the client and closes the connection, but still lets you execute some other PHP code.

from php-ga-measurement-protocol.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.