Ratchet: Evenement\EventEmitter::on() must be callable

Created on 16 Mar 2015  路  5Comments  路  Source: ratchetphp/Ratchet

Hi. I have got problem during making Ratchet tutorial. This is my full error log.

PHP Catchable fatal error: Argument 2 passed to Evenement\EventEmitter::on() must be callable, array given, called in /var/www/ratchet/bin/push-server.php on line 12 and defined in /var/www/ratchet/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php on line 18

I found that if you delete callable attribute before $listener param from EventEmitterInterface then works fine. You should update yours tutorial to new version of Evenement or add specific version to composer.lock.

Best regards.

awaiting feedback

Most helpful comment

For the benefit of others, make sure that the method you're passing has public visibility. Even when you define the callback in the same class, remember that it's going to be called from different context when the event actually gets emitted.

This has stupidly tripped me up more than once!

All 5 comments

Does your $pusher instance have a valid method named onBlogEntry?

Yes

Can you post your source code in a gist so I can replicate it?

Closing due to inactivity. Will re-open if reproducible code is posted.

For the benefit of others, make sure that the method you're passing has public visibility. Even when you define the callback in the same class, remember that it's going to be called from different context when the event actually gets emitted.

This has stupidly tripped me up more than once!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Lugia101101 picture Lugia101101  路  7Comments

Rinum picture Rinum  路  6Comments

mhlz picture mhlz  路  9Comments

clarkk picture clarkk  路  6Comments

tasaif picture tasaif  路  6Comments