Adding timer to a running WampServer

18 views
Skip to first unread message

Alexandros G.

unread,
Jul 25, 2016, 7:36:39 AM7/25/16
to Ratchet

I am setting up a WampServer with Ratchet. Is it possible to add to the loop a timer that calls a WampServer's method every 30 second?


I have tried the following code:


public function addMonitoringTimer(){

    $this->loop->addPeriodicTimer(30, function() {
        ...
        $this->wampServer->methodName();
        ...
    });

} 


but no timers seems to work.


Note: As this code is a class method, $this is a reference to the class object that has references to the WampServer ($this->wampserver) and the loop used by the WampServer ($this->loop). The method I am calling is not part of the WampServerInterface.

Reply all
Reply to author
Forward
0 new messages