Skip to content

Integrate Server Sent event api (EventSource) or streaming HTTP api #135

@theiosdevguy

Description

@theiosdevguy

I have a .NET based HTTP streaming api that I need to integrate on my larval based PHP server application. I have been using Guzzle for it but it is blocking my entire server because of the infinite while loop I had to place. I was exploring this library but I am encountering issues with it. The streaming api is built in a way that it requires a GET HTTP call which redirects to the streaming URL.

Example - GET http://192.168.1.25:4590 (with Auth headers)
Response - Redirects to http://192.168.1.25:4591 (Streaming API)

The problem I am facing is that when I do a GET to http://192.168.1.25:4590, I see no chunk of data in

$response->on('data', function ($chunk) {
        echo $chunk;
});

In fact, the logs suggest that

$response->on('end', function() { echo 'DONE'; });

is called right away.

Please suggest a mechanism to integrate such a streaming api. Or may be the right question here should be how to handle HTTP redirects?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions