public function onHandshake() { $this->defineLocalMethods(['serverTest' => function () { $this->callRemote('clientTest', 'foobar', function () { Daemon::log('callback called'); }); }]); $this->onFrame('{"method":"methods","arguments":[{"clientTest":{}}],"callbacks":{"1":[0,"clientTest"]},"links":[]} ', 'STRING'); parent::onHandshake(); }