Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Missing Async support #1005

Closed
Closed
@enumag

Description

@enumag

At the moment, this library isn't fit to be used in async event loop environment such as Amphp or ReactPHP. While it internally uses asynchronous http client, the API itself is not asynchronous.

The HttpTransport calls wait() which ofc can't be used in an async event loop.

You could say that I can implement my own HttpTransport but the real problem is the TransportInterface. Which states that the send method should return either the event id or null on failure. In async environment I of course don't know if it failed or not since I can't wait for it so the interface is effectively impossible to fulfill. The best I can do is to return a Promise<string|null>.

By reading the documentation that this library isn't tied to any specific http client and that the used http client should be async I was hopeful that it might be fit to be used in async environment too. I'm very disappointed to see that it's actually not the case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions