Search code examples
javascriptphpgetstream-io

Real time updates not triggering on batch add of activity


We are using the PHP implementation of Stream on the back end of our project to batch add an activity to many feeds at once using $batcher->addToMany().

The issue we have is that these activities do not trigger a real time update on the faye channel, even though they appear in the user's notification feed.

Adding an activity to a feed using $feed->addActivity() triggers the listener as expected.

Is this a bug in Stream or a feature that is not available?

Running the PHP implementation of Stream to add activities to user notification feeds. Listening to the same feeds with JS on the front end. I have tried adding the exact same activity element to a single feed using addActivity() and the real time updates functionality works as expected.

private function add_notification_activity( $feed_user_id, $data ) {
    try {
        $notification = $this->client->feed( 'notifications', $feed_user_id );
        $notification->addActivity( $data );
    } catch ( StreamFeedException $e ) {
        $this->catch_stream_exception( $e );
    }
}

private function batch_add_activity( $activity, $feeds ) {
    try {
        $batcher = $this->client->batcher();
        $batcher->addToMany( $activity, $feeds );
    } catch ( StreamFeedException $e ) {
        $this->catch_stream_exception( $e );
    }
}

add_notification_activity triggers the real time update listener as expected.

batch_add_activity adds the exact same activity, but to multiple feeds (confirmed in the Stream feed explorer view), but does not trigger the real time update listener.


Solution

  • batch doesn't trigger realtime. We can't enable it across the board right now or it might cause unexpected behavior for customers currently using it that don't expect it to trigger. We've turned that on for your org. Thanks!