Skip to content

Listen to PHP Events from other script #15

@henrikthorn

Description

@henrikthorn

Would there be a way to use PHP to send an event to the server, which will emit the message to the clients?

I could be something like this:

$i = 0;
while($i <= 1000){
echo $i."\n";
$i++;
$messageEvent = new Event\MessageEvent();
$messageEvent->setMessage(array(
'event' => 'addme',
'message' => "Count $i",
));
$messageEvent->setEndpoint(null);
$dispatcher = Event\EventDispatcher::getDispatcher();
$dispatcher->dispatch("server.addme", $messageEvent, null);
sleep(1);
}

I wish to build an application that reacts on events in PHP and pushes these through socketio. I think the best way would be to integrate this in the server, instead of having a client that'll post it to the server, who will need to handle the events.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions