GithubHelp home page GithubHelp logo

Comments (6)

enygma avatar enygma commented on May 30, 2024

I hadn't thought about it but I could definitely see it being a useful thing. I haven't looked too much into handling of the connections like this (parallel) but it could definitely be an interesting addition.

It does make use of the Guzzle HTTP client, though, which does make supporting these kinds of parallel connections simpler on the HTTP level. It'd just be a matter of wrapping that handling correctly in the request process. I see in your library you've used the cURL multi handling to make the same kind of thing happen. I think there could be some added benefit to using the Guzzle wrapper for it in terms of determining the "first in" without having to muck with the HTTP level requests manually.

Guzzle Parallel Requests

from yubikey.

enygma avatar enygma commented on May 30, 2024

Additionally, I'd like to move the current hosts list to a default kind of thing and allow for the injection of one or more servers. I could see a host setter with ($hosts, $overwrite = false) to make setting these servers easier. Then add a flag to the constructor (boolean) of whether to use the parallel or single request as it does now.

from yubikey.

enygma avatar enygma commented on May 30, 2024

In looking at what you have in your library so far, it looks like you're still waiting for all of the requests to finish out. You're just using the first one returned as the result. Is this the correct use case you're shooting for here?

from yubikey.

enygma avatar enygma commented on May 30, 2024

Hmm, I think I have something cooperating with a curl multi request but it looks like the API servers don't operate independently. I get an OK on the first few but then start getting a REPLAYED_REQUEST closer to the end of the list. If they're not all evaluating them independently, why even have multi-threaded requests? Please correct me if I'm wrong on this one...

from yubikey.

enygma avatar enygma commented on May 30, 2024

Okay, so if you enable multiple server checking and the "first in" parameter, you can call it like this:

$v = new \Yubikey\Validate($apiKey, $clientId);
$response = $v->check($inputtedKey, true);

echo ($response->success(true) === true) ? 'success!' : 'you failed. aw.';

Note the two new true parameters there. If those are left off or set to false, it will only check one server.

from yubikey.

enygma avatar enygma commented on May 30, 2024

Since this is implemented I'm going to close this one out. If there's any issues, open a new issue with it.

from yubikey.

Related Issues (19)

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.